Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do i put multiple values in a variable?

885842Sep 1 2011 — edited Sep 1 2011
Hi, very new to PLSQL but could anybody please help with this problem?

If i do the following statement it works fine:

select salary,name from employers where salary = (select max (salary) from employers) ;

But if i am doing it in PLSQL im stuck in how to assign 2 values into a variable.

I can do the following using just salary:

declare

v1 varchar2 (30);

begin

select salary into v1 from employers where salary = (select max (salary) from employers) ;

end;

However if i try select salary,name into v1 from employers where salary = (select max (salary) from employers) ;

i get the following error:

ORA-06550: line 65, column 31:
PL/SQL: ORA-00947: not enough values
ORA-06550: line 65, column 4:
PL/SQL: SQL Statement ignored


Many thanks


Thank you very much this is answered - unbelievably quick response !!

Edited by: 882839 on 01-Sep-2011 08:51
This post has been answered by user130038 on Sep 1 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2011
Added on Sep 1 2011
11 comments
1,071 views