I saw this on an AskTom question today answered by my colleague Chris. Check out this simple example
SQL> create table T (
2 x int default 1,
3 y int default 1
4 ,z int);
Table created.
It looks like I’ve assigned a default of “1” to both X and Y. But lets now dump out the default definition from the dictionary.
SQL>
SQL> set serverout on
SQL> declare
2 longcol varchar2(200);
3 begin
4 for i in (
5 select column_name, data_default
6 from user_tab_cols
7 where table_name = 'T'
8 )
9 loop
10 longcol := i.data_Default;
11 dbms_output.put_line(i.column_name||'-'||length(longcol));
12 end loop;
13 end;
14 /
X-1
Y-3
Z-
Notice the length of the default for Y. If we output those 3 characters (not shown here) we get “1” (the default), then a line feed, then a space.
So where you put the commas makes a difference ! Of course, ultimately (because its a numeric) the assigned value will not change.




Got some thoughts? Leave a comment