Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: DDL Question

Re: DDL Question

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: 2000/09/21
Message-ID: <969530610.11406.0.nnrp-13.9e984b29@news.demon.co.uk>#1/1

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>...

>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 Thu Sep 21 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US