Prepare for your Next Interview
This is a discussion on Stored Procedure problem... within the MY SQL forums, part of the Databases category; 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....
|
|||
|
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 |
| Sponsored Links |
|
|||
|
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
__________________
Cheers, :) James:) Last edited by jamesravid : 08-03-2007 at 07:16 AM. |
|
|||
|
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 |
|
|||
|
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:
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reg:Stored Procedure | chakravarthy_info | Data Warehousing | 1 | 02-14-2008 12:07 PM |
| Simple example of Oracle Stored Procedure | mann_se | Oracle | 2 | 07-07-2007 02:02 AM |
| implementation of stored procedure | sreenivasamurthy | Data Warehousing | 0 | 06-20-2007 08:59 AM |
| Extended Stored Procedure | venkat_1984 | SQL Server | 1 | 06-16-2007 04:45 PM |
| Create and run the stored procedure | sm_amuda | ASP.NET | 2 | 04-14-2007 07:15 AM |