unhandled exception ora 01422 [message #138793] |
Fri, 23 September 2005 14:05 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sweetgeegee27
Messages: 107 Registered: June 2005
|
Senior Member |
|
|
Can anyone adjust this code for me to include an exception handler? I get the error message unhandled exception ora 01422.
Please note that I am not a pl/sql expert.
DECLARE
V_TAX_ACCT_NO TAX_ACCOUNT.TAX_ACCT_NO%TYPE;
V_IND_NAME VARCHAR2(45);
V_COR_NAME VARCHAR2(45);
v_temp number := null;
BEGIN
IF :DUMMY.PAY_AGREE_NO IS NOT NULL THEN
SELECT tax_ac.tax_acct_no,
IND.LAST_NAME || ', '|| IND. FIRST_NAME,
COR.REGIST_NAME
INTO V_TAX_ACCT_NO,
V_IND_NAME,
V_COR_NAME
FROM tax_account tax_ac,
INDIVIDUAL IND,
CORPORATION COR,
TAX_PAYER TAX_P,
payment_agreement pay_agree
WHERE IND.TAX_PAYER_NO(+) = TAX_P.TAX_PAYER_NO
AND COR.TAX_PAYER_NO(+) = TAX_P.TAX_PAYER_NO
AND TAX_AC.TAX_PAYER_NO = TAX_P.TAX_PAYER_NO
AND pay_agree_no = :dummy.pay_agree_no
AND pay_agree.tax_payer_no = TAX_P.tax_payer_no;
:dummy.tax_acct_no := V_TAX_ACCT_NO;
IF :dummy.pay_agree_no IS NOT NULL THEN
SET_ITEM_PROPERTY('dummy.tax_acct_no', ENABLED, PROPERTY_FALSE);
ELSE
SET_ITEM_PROPERTY('dummy.tax_acct_no', ENABLED, PROPERTY_TRUE);
END IF;
IF V_COR_NAME IS NULL THEN
:dummy.tax_payer_name := V_IND_NAME;
ELSE
:dummy.tax_payer_name :=V_COR_NAME;
END IF;
else
:dummy.tax_payer_name := NULL;
END IF;
END;
[Updated on: Mon, 26 September 2005 19:02] by Moderator Report message to a moderator
|
|
|
Re: unhandled exception ora 01422 [message #138930 is a reply to message #138793] |
Sun, 25 September 2005 21:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Next time please give the full message:"ORA-01422 exact fetch returns more than requested number of rows", put your code between 'code tags' (use the 'braces' icon button), and consider posting in the SQL forum as they will answer this class of question faster than the Forms forum.
Instead of using an exception handler, how about making your SQL return just a single row? Put a 'distinct' into your implicit 'select' statement, or use an explicit cursor and only do a single fetch, or add 'rownum=1' to the 'where' clause.
David
|
|
|