Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

ORA-01422: exact fetch returns more than one requested number of rows tips

Oracle Error Tips by Burleson Consulting

 

Oracle docs note this about ORA-01422:

       ORA-01422: exact fetch returns more than requested number of rows

Cause: The number specified in exact fetch is less than the rows returned.

Action: Rewrite the query or change number of rows requested


You may also be interested in this community troubleshooting from Oracle Forums:

Question:

I continue to receive this ORA-01422 message whenever I get to this stage in the process:

UPDATE TT_FERMS
SET assigned_system_id = 2
WHERE ferm_bank = 3
RETURNING ( SPAC_ASSIGN_FERMS.xfer_seq + 1 ), SPAC_ASSIGN_FERMS.xfer_seq
+ 1 INTO SPAC_ASSIGN_FERMS.xfer_seq, SPAC_ASSIGN_FERMS.xfer_seq;


ERROR:ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "BREW_SCHED.SPAC_ASSIGN_FERMS", line 959

 

Answer:

There are several options to resolve ORA-01422, which take some time to figure out which option is appropriate for you.  Here are some things you may want to try:

  • This is most likely signifying that you have updated multiple rows.  Because of this, Oracle throws the ORA-01422 error because it is not able to return the variables in simple variables.  To remedy this, try BULK COLLECT in a table such as the below:

SQL> declare
2 type num_tab is table of number;
3 empno_tab num_tab;
4 begin
5 update emp set ename = ename
6 returning empno bulk collect into empno_tab;
7 for i in 1..empno_tab.count loop
8 dbms_output.put_line('updated empno '||empno_tab(i));
9 end loop;
10 end;
11 /
updated empno 7839
updated empno 7698
updated empno 7782
updated empno 7566
updated empno 7788
updated empno 7902
updated empno 7369
updated empno 7499
updated empno 7521
updated empno 7654
updated empno 7844
updated empno 7876
updated empno 7900
updated empno 7934

PL/SQL procedure successfully completed.

  • You may want to declare SPAC_ASSIGN_FERMS.xfer_seq because a table may be needed if multiple rows are being updated.
  • If, from update, you are trying to return two values, you should consider defining my_tab
  • Try using a table of a record with two fields, and the record with two fields itself. (NOTE: as of 9.2.0.6, you are not able to use composite targets and returning clauses together. However, returning to collections is allowed.)

 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright ? 1996 -  2014

All rights reserved by Burleson

Oracle ? is the registered trademark of Oracle Corporation.


 

��  
 
 

 
 
 
 
oracle dba poster
 

 
 
Oracle performance tuning software 
 
Oracle Linux poster