Author Topic: exact fetch returns more than requested number of rows  (Read 1904 times)

Prakash

  • Newbie
  • *
  • Posts: 13
    • View Profile
exact fetch returns more than requested number of rows
« on: October 03, 2013, 01:49:11 PM »

-- Example to show error message - "exact fetch returns more than requested number of rows"
Code: [Select]
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.
Code: [Select]
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
« Last Edit: January 05, 2014, 09:43:57 PM by Mike »