Results 1 to 2 of 2

Thread: Urgent Help on create proecedure

  1. #1
    Join Date
    Dec 2006
    Posts
    1

    Urgent Help on create proecedure

    delimiter |
    create PROCEDURE loan_vou
    (in act char, IN appl smallint, IN doc_dt date, IN ln_amt float(12,2), IN cq_no varchar(15),
    IN cq_dt date, IN mem_id smallint, IN Ireg smallint, OUT rtn INT)
    BEGIN
    DECLARE doc_no smallint;
    select ifnull(max(doc_no),0) into doc_no from voucher where reg = Ireg;
    if (doc_no = 0 ) Then
    select st_no into doc_no from voucher_type where sr_no = Ireg;
    end if
    --select doc_no;
    END;
    |
    delimiter ;

    Error : You have an error in your SQL syntax; check the manual that corresponds to your
    MySQL server version for the right syntax to use near 'END' at line 11 

    Please help me out i am a learner.

  2. #2
    Join Date
    Jan 2007
    Posts
    1

    missing semi-comma

    You're missing a semi-comma between the "end if" and the final "end".
    Your code should be:

    create PROCEDURE loan_vou
    (in act char, IN appl smallint, IN doc_dt date, IN ln_amt float(12,2), IN cq_no varchar(15),
    IN cq_dt date, IN mem_id smallint, IN Ireg smallint, OUT rtn INT)
    BEGIN
    DECLARE doc_no smallint;
    select ifnull(max(doc_no),0) into doc_no from voucher where reg = Ireg;
    if (doc_no = 0 ) Then
    select st_no into doc_no from voucher_type where sr_no = Ireg;
    end if;
    --select doc_no;
    END;

Posting Permissions

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