Results 1 to 4 of 4

Thread: Stored Procedure problem...

  1. #1
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Stored Procedure problem...

    This is my stored procedure but it is not working ...

    CREATE PROCEDURE sp_select_custId (IN custId INTEGER)
    BEGIN
    select * from customer c,tapedelivery t where c.CustomerID=t.CustomerId And c.CustomerID = custId;
    END;

    But it is not running ..it is giving error ..please suggest me correct syntax/way to create this procedure


  2. #2
    Expert Member
    Join Date
    Jun 2006
    Answers
    410

    Re: Stored Procedure problem...

    If i am not wrong you can't use "select...from" clause with in a procedure.
    Instead you can either use cursors (for multiple records) or "select...into...from"(for single row) clause.

    We have this rule in Oracle. I think it is also applicable to MY SQL as well.

    correct me if i am wrong

    Last edited by jamesravid; 08-03-2007 at 07:16 AM.

  3. #3
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: Stored Procedure problem...

    mysql> DELIMITER |
    mysql> CREATE PROCEDURE emp_test()
    -> BEGIN
    -> DECLARE x INT;
    -> DECLARE y VARCHAR(25);
    -> SELECT empno,empname INTO x,y FROM emp LIMIT 1;
    -> SELECT x,y;
    -> END|
    Query OK, 0 rows affected (0.00 sec)

    mysql> DELIMITER ;
    mysql> CALL emp_test()\G

    I think this example help u.....
    To know more about it user this link mysql


  4. #4
    Junior Member
    Join Date
    Aug 2007
    Answers
    1

    Re: Stored Procedure problem...

    hi, try this , it will run

    CREATE PROCEDURE sp_select_custId ( custId INT)
    BEGIN
    select * from customer c,tapedelivery t where c.CustomerID=t.CustomerId And c.CustomerID = custId;
    END;








    Quote Originally Posted by psuresh1982 View Post
    This is my stored procedure but it is not working ...

    CREATE PROCEDURE sp_select_custId (IN custId INTEGER)
    BEGIN
    select * from customer c,tapedelivery t where c.CustomerID=t.CustomerId And c.CustomerID = custId;
    END;

    But it is not running ..it is giving error ..please suggest me correct syntax/way to create this procedure



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact