Total Pageviews

Tuesday 21 August 2012

Oracle/PLSQL: ORA-01422 Error

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

Cause: You tried to execute a SELECT INTO statement and more than one row was returned.

Action: The options to resolve this Oracle error are:
  • Rewrite your SELECT INTO statement so that only one row is returned.(Use distinct)
  • Replace your SELECT INTO statement with a cursor.
For example, if you tried to execute the following SQL statement:

SELECT doc_id
 INTO document_listing
 from documents
 where document_name = 'Testing_Doc';

And there was more than one record in the documents table with the document_name of Testing_Doc , you would receive the ORA-01422 error message.

In this case, it might be more prudent to create a cursor and retrieve each row if you are unsure of how many records you might retrieve.

1 comment:

  1. Jadwal Tarung Ayam SV388 17 Februari 2019 di Situs Judi Sabung Ayam Online Melalui Agen Resmi Taruhan Sabung Ayam Live Asli Thailand.

    Bandar Sabung Ayam - Minggu, 17 Februari 2019 – Pada Hari Tersebut Akan Di Laksanakan Berbagai Pertandingan Sabung Ayam Secara Live di Arena Sabung Ayam Thailand.

    Untuk Info Lebih Lanjut Bisa Hub kami Di :
    wechat : bolavita
    line : cs_bolavita
    whatsapp : +628122222995
    BBM: BOLAVITA

    ReplyDelete