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!

Raise_Application_error Problem

LuKKaOct 1 2010 — edited Oct 1 2010
Dear All I am using 10G.
I have a procedure where i am using Raise_application_error.
Here s my code :-

Create or replace procedure Acct_no_Validator(iac_no varchar2)
is
llength number(2);
lstr number(2);
lresult Number(5);
lsum number(5) := 0;
lmod number(10);
omod number(2) ;
ormdir number(2);
lfac number(3);
lcheckD number(1);
lfactor number(3);
Begin
Select MODLR,RMDIR into omod,ormdir
From MU_PAY_PARAM_VALIDATOR
Where rownum = 1;
llength := length(iac_no)-1; -- For the Loop

lcheckD := Substr(iac_no,12,1); -- For the Last number of the AC no

FOR i in 1 .. llength LOOP

Select WEIGHT_FACTOR into lfactor
From MU_PAY_CHECK_DIGIT
Where NO_POSITION = i;

lstr := Substr(iac_no,i,1);

lresult := lstr * lfactor ;

lsum := lsum + lresult ;


lMod := MOD(lsum,omod) ;

lfac := 11 - lmod ;

END LOOP;

IF lcheckD = lfac Then
Dbms_output.put_line ('Account No Validation is Correct');
ELSIF lfac > 9 Then
lfac := lfac - 3;
IF lcheckD = lfac Then
Dbms_output.put_line ('Account No Validation is Correct');
ELSE
Dbms_output.put_line ('Account No Validation is Correct');
Raise_Application_Error(-20000,'Account No Validation Failed ');
END IF ;
ELSE
Dbms_output.put_line (lcheckD||'-'||lfac);
Raise_Application_Error(-20001,'Account No Validation Failed ');
END IF ;

Exception
When NO_Data_Found Then
Dbms_output.put_line ('No Moduler and reminder available in the table ');

End ;
/


Here if i am giving Correct AC no then it showing corrrect message . BUt if i am giving Wrong AC no then it is also showing the Wrong message as per the Procedure but after that also showing this :

BEGIN Acct_no_Validator('000123987657'); END;

***
ERROR at line 1:
ORA-20001: Account No Validation Failed
ORA-06512: at "DEV.ACCT_NO_VALIDATOR", line 52
ORA-06512: at line 1

Why it is coming like this ?

Edited by: LuKKa on Oct 1, 2010 11:37 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 29 2010
Added on Oct 1 2010
10 comments
761 views