BEFORE トリガーを使用して実行できます。
&
& を、" を"
;に置き換える例を次に示します。
SET DEFINE OFF;
drop table test;
create table test (checkit varchar2(60));
CREATE OR REPLACE TRIGGER validateTest
BEFORE DELETE OR INSERT OR UPDATE ON test
FOR EACH ROW
BEGIN
:new.checkit := replace(:new.checkit, '&', '<e;');
:new.checkit := replace(:new.checkit, '"', '"');
END;
/
insert into test (checkit) values ('Here is the & test "data"');
select * from test;
出力:
drop table test succeeded.
create table succeeded.
TRIGGER validateTest Compiled.
1 rows inserted
CHECKIT
------------------------------------------------------------
Here is the <e; test "data"
1 rows selected
明らかに、置換文字列は何でもかまいません。