troubleshooting Question

Not able to store the rows returned by a select statement in a nested table in plsql

Avatar of sam_2012
sam_2012 asked on
Oracle Database* Oracle PL/SQL
1 Comment1 Solution9 ViewsLast Modified:
Hi Team,

I have written the below code to store the data returned from a select into nested table in PLSQL. When I run the code, I am getting the error mentioned below. Any help is really appreciated.

create or replace type tr_empdata is object
(
 empid number(10),
 ename varchar2(80)
);

create or replace type nt_emp is table of tr_empdata;
declare
l_empdata nt_emp;
begin
Select employee_id , concat(first_name||' ',last_name) ename into l_empdata
from employees;
end;
/

Error:
Error starting at line 8 in command:
declare
l_empdata nt_emp;
begin
Select employee_id , concat(first_name||' ',last_name) ename into l_empdata
from employees;
end;
Error report:
ORA-06550: line 4, column 77:
PL/SQL: ORA-00947: not enough values
ORA-06550: line 4, column 1:
PL/SQL: SQL Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:



Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros