plsql - Oracle: Deferring a constraint in a begin/end block? -


how defer constraint inside begin/end block?

this works:

sql> set constraint t_pk deferred;                                               constraint set. 

but identical statement fails in begin/end block:

sql> begin 2  set constraint t_pk deferred; 3  end; 4  / set constraint t_pk deferred;     * error @ line 2: ora-06550: line 2, column 5: pl/sql: ora-00922: missing or invalid option ora-06550: line 2, column 1: pl/sql: sql statement ignored 

you need use execute immediate:

begin execute immediate 'set constraint t_pk deferred'; end; 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -