Skip to content
Advertisement

Not enough values selecting into a table value

Here is the code:

and the following function doesn’t compile:

It says:

PL/SQL: ORA-00947: not enough values

Why is that?

Advertisement

Answer

Why is that?

You are trying to put 3 values (and multiple rows) into a single variable.


Use BULK COLLECT INTO and wrap the values in the object type:

Given the sample data:

Then:

Outputs:

FULL_NAME PHONE_NUMBER SALARY
Baron Betty 1111111 250000
Chris Carol 9876543 300000

db<>fiddle here

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement