MarcielDeg
Member²
I got a problem running DDL query to set a default value to a column:
Test case: Running in a SQL Window:
In this case, default value has an extra enter (0D0A):
But, if I run alter table query in this way:
it works correctly:
I tried oracle client versions 11, 19 and 21, with the same result. I believe that PL/SQL is manipulating SQL improperly before executing.
I'm using PL/SQL Developer v15.0.4
Test case: Running in a SQL Window:
Code:
CREATE TABLE TEST1 (ID NUMBER(10), STATUS NUMBER(2))
Code:
ALTER TABLE TEST1 MODIFY STATUS DEFAULT 0
Code:
SELECT USER_TAB_COLS.DATA_DEFAULT
FROM USER_TAB_COLS
WHERE USER_TAB_COLS.TABLE_NAME = 'TEST1'
AND USER_TAB_COLS.COLUMN_NAME = 'STATUS'
In this case, default value has an extra enter (0D0A):

But, if I run alter table query in this way:
Code:
BEGIN
EXECUTE IMMEDIATE 'ALTER TABLE TEST1 MODIFY STATUS DEFAULT 0';
END;
it works correctly:

I tried oracle client versions 11, 19 and 21, with the same result. I believe that PL/SQL is manipulating SQL improperly before executing.
I'm using PL/SQL Developer v15.0.4
Last edited: