By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,666 Members | 1,909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,666 IT Pros & Developers. It's quick & easy.

How to pass table name as IN Parameter

P: 1
HI All,

I have a requirement, I need to pass table as IN parameter in the stored procedure. But when I do this it just says Table 'database.strtable' doesn't exist
.
Can you guys please advice me how can I do so. I need to pass table from outside. Following is my stored procedure, please have a look

DELIMITER $$;
DROP PROCEDURE IF EXISTS `user`.`sp_performancereport`$$
CREATE DEFINER=`user`@`%` PROCEDURE `sp_performancereport`(startDate date,endDate date,user VARCHAR(255),strTable VARCHAR(255))
BEGIN
select R.DIAGNOSTIC_ID,
R.FEEDER_ID,
R.FEEDER_NAME,
R.DIAGNOSTIC_NAME,
R.UNIT UNIT,
Round(Max(VALUE),2) MAX_VALUE,
Round(MIN(VALUE),2) MIN_VALUE ,
Round(AVG(VALUE),2) MEAN_VALUE,
Round(STDDEV_POP(VALUE),2) STD
from strTable R
where R.TIMESTAMP between startDate and endDate
and R.FEEDER_ID IN (select DEVICE_ID from gm_temp_devices where USER_ID=user)
group by R.DIAGNOSTIC_ID
order by R.FEEDER_NAME,R.DIAGNOSTIC_NAME;
END$$
DELIMITER ;$$
Mar 31 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.