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

Home -> Community -> Usenet -> c.d.o.tools -> Re: ERROR:an INTO clause is expected in this SELECT statement

Re: ERROR:an INTO clause is expected in this SELECT statement

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: 2000/06/28
Message-ID: <3959E31D.83B@yahoo.com>#1/1

wilhelm wrote:
>
> Hallo my all friends
>
> This is a PL/SQL-Script for Oracle which write dependet from
> the minutes a column name in a varible for the select-statment
>
> If i start the PL/SQL-Script only with the if-statment
> It works correct.
>
> If i start the PL/SQL-Script only with the select-statment
> It works correct.
>
> If i start the PL/script with both (if- and select-statement
> Then the system write the follow error:
> What is wrong ?
>
> select datum, wert_8
> *
> Error in line 22:
> ORA-06550: line 22, column 1:
> PLS-00428: an INTO clause is expected in this SELECT statement
> ORA-06550: line 22, column 1:
> PL/SQL: SQL Statement ignored
>
> -----------------------------------------------------------------
> -
> BEGIN
> DECLARE
> now_time varchar2(2);
> colname varchar2(7);
>
> BEGIN
> now_time:=to_char(sysdate,'mi');
>
> IF now_time='01' THEN
> Colname:='wert_20';
> ELSIF now_time='02' THEN
> Colname:='wert_20';
> ELSIF now_time='03' THEN
> Colname:='wert_20';
> ELSIF now_time='04' THEN
> Colname:='wert_1';
> ELSIF now_time='04' THEN
> Colname:='wert_1';
> ELSIF now_time='04' THEN
> Colname:='wert_1';
> ...........
> ............
> ELSE
> Colname:='wert_19';
> END IF;
>
> select datum, wert_8 from tabelle1
> where datum = (select max(datum) from tabelle1)
> END;
> END;
> /
> -----------------------------------------------------------
>
> I now the column wert_8 is not necessary. That’s only a test.
> In the next step I want to write instead of wert_8 the
> Variable Colname.
> How functioning it ?
>
> Got questions? Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com

When you do a select, the result has to go somewher, thus

select blah
INTO a_plsql_variable
from table
where ...

is required.

HTH

-- 
===========================================
Connor McDonald
http://www.oracledba.co.uk

We are born naked, wet and hungry...then things get worse
Received on Wed Jun 28 2000 - 00:00:00 CDT

Original text of this message

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