Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: DDL Question
No, not possible.
It is mentioned somewhere in the manuals,
unfortunately not in the obvious place.
The SQL Reference manuals says the default
can be an 'expression' other than a couple of
restrictions - but it doesn't include the restriction
that you can't use user-defined function.
It looks as if you have been doing :
alter table ... to modify the default If you had done
create table (... default myfunc()) you would have got the more obvious error:
ORA-04044 "procedure, function, package, or type is not allowed here"
-- Jonathan Lewis Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk Rozi & George Goldberger wrote in message <8vby5.1071$QI1.98725_at_bgtnsc04-news.ops.worldnet.att.net>...Received on Thu Sep 21 2000 - 00:00:00 CDT
>Is it possible to use a user defined function in a DEFAULT declaration for
a
>column ?
>Something like:
>
>create table test(
>col varchar2(36) default myfunc() not null
>);
>
>create or replace function myfunc
>return varchar2 deterministic
>is
>cGuid varchar2(36);
>cNewID varchar2(36) default sys_guid();
>begin
>cGuid := substr(cNewId,1,8) | | '-' | | substr(cNewId,9,4) | | '-' | |
>substr(cNewId,13,4) | | '-' | | substr(cNewId,17,4) | | '-' | |
>substr(cNewId,21,12);
>return (cGuid);
>end myfunc;
>
>
>When I do that I receive an ORA-02262 ORA-%05d checking col expression
>failed
>
>
>
>