You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let create a table having a field with default value and procedure inserting data in that table.
Next, let change the field default value. The stored procedure will continue producing a records containing the old default until recompiling of stored procedure referencing that table.
SQL> CREATE TABLE t1 (
CON> F1 integer,
CON> F2 integer DEFAULT 1);
SQL> set term ^;
SQL> create procedure p1
CON> as
CON> begin
CON> insert into t1(f1) values (0);
CON> end^
SQL> set term ; ^
SQL> execute procedure p1;
SQL> select * from t1;
F1 F2
============ ============
0 1
SQL> alter table t1 alter f2 set default 2;
SQL> insert into t1(f1) values (1);
SQL> select * from t1;
F1 F2
============ ============
0 1
1 2
SQL> execute procedure p1;
SQL> select * from t1;
F1 F2
============ ============
0 1
1 2
0 1
SQL>
The text was updated successfully, but these errors were encountered:
Submitted by: Yovtcho S Zagorov (yotce)
Let create a table having a field with default value and procedure inserting data in that table.
Next, let change the field default value. The stored procedure will continue producing a records containing the old default until recompiling of stored procedure referencing that table.
SQL> CREATE TABLE t1 (
CON> F1 integer,
CON> F2 integer DEFAULT 1);
SQL> set term ^;
SQL> create procedure p1
CON> as
CON> begin
CON> insert into t1(f1) values (0);
CON> end^
SQL> set term ; ^
SQL> execute procedure p1;
SQL> select * from t1;
============ ============
0 1
SQL> alter table t1 alter f2 set default 2;
SQL> insert into t1(f1) values (1);
SQL> select * from t1;
============ ============
0 1
1 2
SQL> execute procedure p1;
SQL> select * from t1;
============ ============
0 1
1 2
0 1
SQL>
The text was updated successfully, but these errors were encountered: