Since this query can return more than one row you need to use a cursor and a cursor-for loop to iterate over results. However you cannot return more than one member name using a varchar; you could use a PL-SQL table.
Oracle ORA-01422: exact fetch returns more than requested number of rows
-
14-04-2022 - |
Vra
I am trying to create a member function that returns the member names of expired members. My select query works outside of the member function and this member function compiles with no problems but when I call the function I get this error:
ORA-01422: exact fetch returns more than requested number of rows
I assume it is something simple but I have not been using Oracle for long so got a bit stuck with syntax. Can anyone help with this?
Oplossing
Ander wenke
select m.forename into memberName from member_tab m where ADD_MONTHS(m.datejoined, 64) < SYSDATE;
looks like this query is returning more than 1 results ...
u can use a select count(*) or exception handling to address the exception and handle >1 results
Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow