-- Example to show error message - "exact fetch returns more than requested number of rows"
DECLARE
x DUAL.dummy%TYPE;
BEGIN
SELECT dummy
INTO x
FROM DUAL, (SELECT * FROM all_users);
END;
--Solution to correct this is by fetching rows that can be accommodated into the catching variable.
DECLARE
x DUAL.dummy%TYPE;
BEGIN
SELECT dummy
INTO x
FROM DUAL;
-- SELECT * FROM all_users; --Can't do this here
END;
-- This error occurs when more number of rows are retrieved and being assigned to a variable
-- that can hold only one single value. You need to retrieve only row(s) that can be held in the
-- catching variable