Oracle Error: ORA-01422
Exact fetch returns more than requested number of rows
The number specified in exact fetch is less than the rows returned.
Rewrite the query or change number of rows requested.
By default, a SELECT INTO statement must return only one row. Otherwise, PL/SQL raises the predefined exception TOO_MANY_ROWS and the values of the variables in the INTO clause are undefined. Make sure your WHERE clause is specific enough to only match one row.
If no rows are returned, PL/SQL raises NO_DATA_FOUND. You can guard against this exception by selecting the result of an aggregate function, such as COUNT or AVG(), where practical. These functions are guaranteed to return a single value, even if no rows match the condition.
Add a comment
|Janna Wykers||Aug 1st, 2010 9:43pm|
|This stumped me at first. It means that you're trying to execute a SELECT ... INTO ... inside a PL/SQL block, but the SELECT is returning more than 1 row. A SELECT INTO always needs to return a single row. If there is more than 1 row coming back then this is the error that gets generated. If there are no rows returned you'll get the "ORA-01403: No data found" error message. Hope this helps someone!|