Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Inserting constant value...
foo.c_bar can be use only in PL/SQL not in SQL:
v734> CREATE OR REPLACE PACKAGE foo IS
2 c_bar CONSTANT NUMBER := 1;
3 END;
4 /
Package created.
v734> create table t (col number);
Table created.
v734> insert into t values (foo.c_bar); insert into t values (foo.c_bar)
*
v734> exec insert into t values (foo.c_bar);
PL/SQL procedure successfully completed.
v734> select * from t;
COL
1
1 row selected.
--
Have a nice day
Michel
<tiluki_at_my-deja.com> a écrit dans le message : 87s6jg$joh$1_at_nnrp1.deja.com...
> Anyone know if/how to get round this...
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> -- Define a package spec. with constants in it...
>
> CREATE OR REPLACE PACKAGE foo IS
> ...
> c_bar CONSTANT NUMBER := 1;
> ...
> END;
>
> -- Then try to do an insert into a table...
> -- Using the constant as one of the values!
> -- This is attempted 'outside' the package body.
>
> INSERT INTO icarenot (val) VALUES (foo.c_bar);
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> I know and have tried all the varients of 'EXPR' (short of creating
> access methods in the package to the constants).
>
> Thanks in advance,
>
> T.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Feb 10 2000 - 02:29:11 CST