Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to defer a defferable constraint in plsql + solution
Hello,
I was about to post the question
"How to make a deferrable constraint deferred while running plsql".
I just found the answer, so in case anybody wants to know, this is how:
drop table effe_table;
create table effe_table (c1 number);
ALTER TABLE effe_table
ADD(CONSTRAINT UK1_effe_table UNIQUE(c1) deferrable)
/
begin
execute immediate 'set constraint uk1_effe_table deferred';
insert into effe_table values (1);
insert into effe_table values (1);
end;
/
commit;
This gives folliwng output:
Tabel is verwijderd.
Tabel is aangemaakt.
Tabel is gewijzigd.
PL/SQL-procedure is geslaagd.
SQL> commit;
commit
*
FOUT in regel 1:
.ORA-02091: transaction rolled back
ORA-00001: unique constraint (JAVAFARM.UK1_EFFE_TABLE) violated
-- Andre van Winssen andrew_at_info.nlReceived on Thu Jan 17 2002 - 09:05:35 CST