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: Inserting constant value...

Re: Inserting constant value...

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Thu, 10 Feb 2000 09:29:11 +0100
Message-ID: <87tst4$2c66$1@news5.isdnet.net>


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)

                          *

ERROR at line 1:
ORA-00984: column not allowed here

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

Original text of this message

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