Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-01402

875255Aug 30 2012 — edited Aug 30 2012
i have a two tables with following columns

DOCUMENTNO | DOCDATE | SERIAL (table_name=MASTER).
ITEMCODE | DEPARTMENT | QUANTITY | SERIAL (table_name=DETAIL).

here MASTER.SERIAL=DETAIL.SERIAL

the table named MASTER contains only one record against one SERIAL.
but the table name DETAIL can contain many records against one SERIAL.

a cursor selects DOCUMENTNO from MASTER table and stores it into a variable V_DCNO.
now the main command comes which sometimes got the issue.

select MASTER.DOCDATE,DETAIL.DEPARTMENT into V_DCDATE,V_DEPTNO from MASTER,DETAIL
where MASTER.SERIAL=DETAIL.SERIAL and MASTER.DOCUMENTNO=V_DCNO AND DETAIL.ITEMCODE=V_ITMCOD;

now the upper command will return more then one rows if DEPARTMENT is more then one in one document against V_ITMCOD.

in such case variables cant hold double information of two rows. and it raises ORA-01402.

how to solve this problem please help?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 27 2012
Added on Aug 30 2012
8 comments
492 views