Results 1 to 2 of 2

Thread: Ora-01422

  1. #1
    Join Date
    Sep 2003
    Posts
    6

    Red face Unanswered: Ora-01422

    Dear all,

    ORA-01422 is the error that I got.
    here is my code and I dont know if it works. I am a newbie, that haven't slept for days to learn ORACLE. Please help.

    FUNCTION MOTO_APPLY
    RETURN NUMBER IS
    var_moto number(7);
    temp1 varchar2(10);
    temp2 varchar2(10);
    temp3 varchar2(10);
    BEGIN -- 1ST BEGIN
    SELECT DELVNO INTO TEMP3
    FROM JTRE.DELIVER1;
    SELECT BATCHNO INTO TEMP1
    FROM JTRE.DELIVER2;
    SELECT BATCHNO INTO TEMP2
    FROM JTRE.JTRE;
    IF (TEMP3 = TEMP1 AND TEMP1 = TEMP2)
    then
    begin--inside if
    select sum(QTY2) into var_moto
    from JTRE.JTRE where KIND='1' and DELIVER='Y';
    exception when others then var_moto:=null;
    message('finishY');
    end;--inside if
    end if; -- end if
    RETURN (VAR_MOTO);
    END; -- 1ST END;



    ALSO, HERE IS MY OLD CODE THAT HAVE NO 01422 ERROR, BUT WHY?

    FUNCTION moto_apply
    RETURN NUMBER IS
    var_moto number(7);
    BEGIN
    begin
    select sum(QTY2) into var_moto
    from JTRE.JTRE where KIND='1' and DELIVER='Y';
    exception when others then var_moto:=null;
    end;
    return(var_moto);
    END;



    thanksssssssssssssssssssssssssss

  2. #2
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    Hi,

    It looks like you're missing the END; for the actual function. Also get rid of those variables called TEMPx. I deal with servers running 100's of thousands of lines of code and might encounter 1 or 2 temp's, not three in 20 lines :-) They're awful.

    Hth
    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •