Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> DDL Question
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 Received on Wed Sep 20 2000 - 00:00:00 CDT