|
-
hi all.
Sample Record Set.
sal_ sal_ sal_
stmt_id enty_id stmt_iss_dt
121764 50595 8/15/2001
121722 50595 8/15/2001
120521 50595 8/15/2001
120476 50595 7/16/2001
119385 50595 7/16/2001
119338 50595 6/15/2001
118231 50595 6/15/2001
here is SQL script and the error details.
could you pl. let me know how to fix the following script.
DECLARE
v_amt NUMBER;
v_id NUMBER;
CURSOR c1 IS
SELECT MAX(sal_stmt_iss_dt) sal_dt,sal.sal_enty_id
FROM sales_statement sal
GROUP BY sal.sal_ENTY_ID;
BEGIN
FOR r1 IN c1 LOOP
-- dbms_output.put_line(r1.sal_enty_id||' '||r1.sal_dt);
SELECT sal_stmt_drv_bal_amt,sal_stmt_id
INTO v_amt,v_id
FROM sales_Statement ag
WHERE ag.sal_enty_id = r1.sal_enty_id
AND ag.sal_stmt_iss_dt = r1.sal_dt
;
dbms_output.put_line(r1.sal_enty_id||' '||r1.sal_dt);
dbms_output.put_line(v_amt||' '||v_id);
END LOOP;
END;
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 18
thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|