Oracle – ORA-01007: variable not in select list

Error: ORA-01007: variable not in select list

Cause: A reference was made to a variable not listed in the SELECT clause. In OCI, this can occur if the number passed for the position parameter is less than one or greater than the number of variables in the SELECT clause in any of the following calls: DESCRIBE, NAME, or DEFINE. In SQL*Forms or SQL*Report, specifying more variables in an INTO clause than in the SELECT clause also causes this error.

Action: Determine which of the problems listed caused the problem and take appropriate action.

Example

I have faced the same problem/error in my one of the script once I checked and found number of column in the SELECT clause is less than the variables in an INTO clause.

Solution:

The number of column in the SELECT clause should be same as variables in an INTO clause.