Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Could I use user define function as default value of a column?

0 views
Skip to first unread message

Jack.Lee

unread,
Jul 8, 2008, 8:01:18 AM7/8/08
to
I wanna add a user define function as default value of a column.But
oracle raise an error.Could I do that?

Thanks a lot!
Jack.Lee

Lothar Armbrüster

unread,
Jul 8, 2008, 12:07:44 PM7/8/08
to
"Jack.Lee" <gzja...@gmail.com> writes:

Oracle's documentation (for 11g) says:

Restriction on Default Column Values
A DEFAULT expression cannot contain references to PL/SQL functions or to other
columns, the pseudocolumns CURRVAL, NEXTVAL, LEVEL, PRIOR, and ROWNUM, or date
constants that are not fully specified.

Maybe you could use a before insert trigger to accomplish your needs.

Hope that helps,
Lothar

--
Lothar Armbrüster | lothar.ar...@t-online.de
Hauptstr. 26 |
65346 Eltville |

BicycleRepairman

unread,
Jul 9, 2008, 2:48:16 PM7/9/08
to

Take a look at Virtual Columns in 11g. It might not be exactly what
you're looking for, but it is incredibly useful for some of the use
cases you might be thinking of.

0 new messages