MySQL Forums
Forum List  »  Stored Procedures

Re: Simple stored procedure question
Posted by: Les Stockton
Date: January 13, 2006 10:29AM

Got it to work, as follows:

CREATE PROCEDURE `testcreate`.`MyAddRecord`(IN TblName varchar(50),OUT NewIDVal int)
BEGIN
SET @stmt := CONCAT('INSERT INTO ', TblName, ' () VALUES()');
PREPARE stmt1 FROM @stmt;
EXECUTE stmt1;
SET NewIDVal := LAST_INSERT_ID();
END

Options: ReplyQuote


Subject
Views
Written By
Posted
2601
January 12, 2006 02:06PM
1455
January 12, 2006 03:22PM
1558
January 12, 2006 03:37PM
1531
January 12, 2006 03:54PM
1647
January 12, 2006 04:03PM
1640
January 12, 2006 04:19PM
1591
January 12, 2006 04:46PM
1570
January 12, 2006 05:21PM
Re: Simple stored procedure question
1486
January 13, 2006 10:29AM
1545
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.