Dynamically construct and execute SQL in StoredProcedure
am 24.04.2006 15:31:38 von FredHey!
I need to dynamically create an SQL statement within a MySQL 5.0.20
stored procedure.
-- PSEUDO CODE
create procedure DynSQLTest
(
in sTable varchar(45)
)
begin
declare sSQL varchar(45);
select Concat('select * from ',sTable,' where ...) into sSQL;
EXECUTESQL(sSQL);
end;
Is there a possibility to construct the SQL in a varchar and then
execute it? I spent some time googling but did not find anything.
Thank you for any help!
Fred