Below i have created one procedure, which took 2 parameter called company_name and SN_F,
I want to pass the table name to procedure as parameter for which i want to create cursor.
DELIMITER //
CREATE PROCEDURE transfer_t(IN company_name varchar(50), SN_f int)
BEGIN
DECLARE done BOOLEAN DEFAULT 0;
DECLARE dates_f date default null;
DECLARE high_f float default 0.0;
DECLARE low_f float default 0.0;
DECLARE open_f float default 0.0;
DECLARE close_f float default 0.0;
DECLARE volume_f int default 0;
DECLARE adj_close_f float default 0.0;
DECLARE Company_detail cursor for
select Date, high, low, open, close, volume, adj_close from company_name;
Declare CONTINUE HANDLER FOR NOT FOUND SET done=1;
OPEN Company_detail;
REPEAT
FETCH company_detail into dates_f, high_f, low_f, open_f, close_f, volume_f, adj_close_f;
insert into historic_data(sn ,Date ,High ,low ,open ,close , volume , adj_close) values (SN_f,dates_f,high_f,low_f,open_f,close_f, volume_f, adj_close_f);
until done END REPEAT;
close company_detail;
END//
DELIMITER ;
above procedure gets created successfully, but whenever i called it like,
call transfer_t('tcs_temp', 1);
it gives the following error
Error Code: 1146. Table 'test_schema.company_name' doesn't exist
Please help me solve this...