ORA-01402
875255Aug 30 2012 — edited Aug 30 2012i 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?