I’m using Oracle 10g and need to use a variable in a where clause of a SELECT; eg.
DECLARE
v_blah NUMBER;
BEGIN
v_blah := 13;
SELECT * FROM PEOPLE p WHERE p.LuckyNumber = v_blah;
END;
but am getting an error saying
PLS-00428: an INTO clause is expected in this SELECT statement
It seems to work fine in a DELETE or INSERT statement, so I’m not sure why it wouldn’t work here.
The correct syntax is:
The select statement in PL/SQL requires a place where store the query result. In this example the place is
v_people_recvariable.The example above expects exactly one row to be returned. In other cases it will throw exceptions
NO_DATA_FOUNDorTOO_MANY_ROWS.