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

From: Lothar Armbrüster <lothar.armbruester_at_t-online.de>
Date: Tue, 08 Jul 2008 18:07:44 +0200
Message-ID: <878wwcxstr.fsf@t-online.de>


"Jack.Lee" <gzjacklee_at_gmail.com> writes:

> 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

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.armbruester_at_t-online.de
Hauptstr. 26       |
65346 Eltville     |
Received on Tue Jul 08 2008 - 11:07:44 CDT

Original text of this message