Re: table name as stored procedure parameter
Hi shaun,
Try:
DELIMITER $$
DROP PROCEDURE IF EXISTS `eduplan`.`GetStakeholder`$$
CREATE PROCEDURE `eduplan`.`GetStakeholder`(usingtable varchar(255), usingid varchar(255), identifier varchar(255))
BEGIN
SET @qry = CONCAT('SELECT * FROM ', usingtable, ' WHERE ', usingid,' = ?');
PREPARE stmt1 FROM @qry;
SET @c = identifier;
EXECUTE stmt1 USING @c;
DEALLOCATE PREPARE stmt1;
END$$
DELIMITER ;
Subject
Views
Written By
Posted
17254
October 08, 2007 09:00AM
5959
October 08, 2007 11:01AM
6044
October 08, 2007 11:16AM
Re: table name as stored procedure parameter
11107
October 08, 2007 01:08PM
5175
October 08, 2007 02:05PM
4480
October 08, 2007 11:38AM
4475
October 08, 2007 01:05PM
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.