Xref: alice comp.databases.oracle.server:79479
Path: alice!news-feed.fnsi.net!newsfeed.icl.net!news-MUC.ecrc.net!newsfeed00.sul.t-online.de!newsmm00.btx.dtag.de!t-online.de!news.btx.dtag.de!not-for-mail
From: Maxim Demenko <mdemenko@t-online.de>
Newsgroups: comp.databases.oracle.server
Subject: Re: SELECT INTO in SQL*Plus
Date: Sat, 01 Jan 2000 14:51:46 +0100
Organization: T-Online
Lines: 55
Message-ID: <ed1s6sg1lpmb5ul92e2lhu2kkhoo135tg3@4ax.com>
References: <385e70a3.13058318@news.earthlink.net> <38691EEE.FD51CEAF@mycity.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news03.btx.dtag.de 946734684 14064 320021737539-0001 000101 13:51:24
X-Complaints-To: abuse@t-online.de
X-Sender: 320021737539-0001@t-dialin.net
X-Newsreader: Forte Agent 1.7/32.534

On Tue, 28 Dec 1999 21:34:54 +0100, Cong TANG <lai-tang@mycity.at>
wrote:

>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
>
alternately this command works too:
SQL>variable i number
SQL>execute select count(*) into :i from dba_tables;
