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: SELECT INTO in SQL*Plus

Re: SELECT INTO in SQL*Plus

From: Cong TANG <lai-tang_at_mycity.at>
Date: Tue, 28 Dec 1999 21:34:54 +0100
Message-ID: <38691EEE.FD51CEAF@mycity.at>


SELECT ... INTO is a PL/SQL statement, hence must be part of a PL/SQL block.
Example:

SQL> variable x number;
SQL> begin
  2 select count(*) into :x
  3 from emp;
  4 end;
  5 /

PL/SQL procedure successfully completed.

SQL> print x;

        X


       14

Cong Tang

NetComrade wrote:

> SQL> variable i number
> SQL> select count(*) into :i from dba_tables;
>
> COUNT(*)
> ----------
> 149
>
> SQL> print i
>
> I
> ----------
>
> SQL>
>
> How come this doesn't work? I wanted to use this to do some
> arithmetics later in my report.
>
> Thanx.
>
> ---------------
> In case I forgot to mention:
> We use Oracle 7.3.4 on Solaris 2.6, 2.7 boxes
> ---------------
> Andrey Dmitriev eFax: (978) 383-5892 Daytime: (917) 750-3630
> AOL: NetComrade ICQ: 11340726 remove NSPAM to email
Received on Tue Dec 28 1999 - 14:34:54 CST

Original text of this message

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