I am trying to define a variable with another variable. The purpose is to substitute the value in a variable at runtime.
I am not sure if I am asking the right questions or stating the right example.
DECLARE param1 VARCHAR(10);
DECLARE param2 VARCHAR(10);
DECLATE tempVar VARCHAR(1):= 'A';
DECLARE query VARCHAR(200) := 'select * from tmp_table where col1 = <variable>';
BEGIN
IF tempVar = 'A' THEN
-- EXECUTE IMMEDIATE query using param 1;
ELSE
-- EXECUTE IMMEDIATE query using param 2;
END IF;
END;