I perform daily extractions from the same table. The only thing that ever changes is the range of a column called SAMPLE_ID
, so I would like to assign a fixed value to two variables: id_min
and id_max
so that I can update their values before running the query.
I tried the following:
DECLARE
id_min CONSTANT INTEGER := 17778;
id_max CONSTANT INTEGER := 17803;
BEGIN
SELECT
*
FROM
MDB.SCORES
WHERE
SAMPLE_ID BETWEEN id_min AND id_max;
END;
I expected this code to use the numbers assigned to id_min
and id_max
as the lower and upper bounds of the BETWEEN
function in the WHERE
clause, but I'm getting this message:
ORA-06550: line 6, column 5:
PLS-00428: an INTO clause is expected in this SELECT statement
It seems someone ran into something similar in this thread, but I do not understand the solutions provided.