Simple stored procedure question
Forgive me for asking this. I checked the documentation, but was unclear on some of this, so I decided to go try to create this stored procedure, which does work in SQL Server. I'm wanting to do the same thing in MySQL.
Create Proc MyAddRecord ( @TblName varchar(50), @NewIDVal int OUTPUT ) AS EXECUTE('INSERT INTO [' + @TblName +
'] DEFAULT VALUES') SET @NewIDVal = @@IDENTITY
I tried the following:
CREATE PROCEDURE `testcreate`.`MyAddRecord` (@TblName varchar(50),@NewIDVal int OUTPUT)
BEGIN
EXECUTE('INSERT INTO [' + @TblName + '] DEFAULT VALUES')
SET @NewIDVal = @@IDENTITY
END
That didn't work.
So is this a small incompatibility and a slight syntax change, or is this an entirely different thing?
Can someone tell me what the correct Create Procedure would be?
Subject
Views
Written By
Posted
Simple stored procedure question
2612
January 12, 2006 02:06PM
1459
January 12, 2006 03:22PM
1566
January 12, 2006 03:37PM
1534
January 12, 2006 03:54PM
1652
January 12, 2006 04:03PM
1647
January 12, 2006 04:19PM
1595
January 12, 2006 04:46PM
1574
January 12, 2006 05:21PM
1494
January 13, 2006 10:29AM
1552
January 13, 2006 12:19PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.