Click here to Skip to main content
15,900,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was writing a procedure wherein i wanted to execute more than 1 select query.

Below is the snippet of what i was looking for, when i run the snippet i get an error saying "an INTO clause is expected in this SELECT statement" the 2nd select query.

In SQL we could write such queries, but in PL/Sql it doesn't allow. I am a beginner in PL/Sql. I am using Sql developer to write queries & run the scripts.

Any help would be appreciated.

Thanks in advance.

What I have tried:

declare 
varruleid NUMBER(38,0);
Begin
Select RL.RULEID into varruleid from RULELIB RL where RL.RULEID = 5048;

select * from TESTFUNCTIONINTEST where RULEID=varruleid;
End;
Posted
Updated 17-May-17 19:51pm

SQL
/*add this to your declaration */
-- declare (record) variable 'tftrec' to match table structure
tftrec TESTFUNCTIONINTEST%rowtype;  

/* and in your code */
select * into tftrec from testfunctionintest where ruleid = varruleid;
 
Share this answer
 
Comments
Maciej Los 18-May-17 1:51am    
5ed!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900