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
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
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 [URL="http://dev.mysql.com/doc/refman/5.0/en/stored-procedures.html"]mysql[/URL]
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=psuresh1982;14777]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[/QUOTE]