Re: How can I pass a table name to a stored procedure?
Posted in 1996
The SPL doesn't support dynamic SQL (at least in V6).
What you would have to do (if SPL supported dynamic SQL) to get it
working, would be to assign your statement to a string, prepare and
execute it, fetch the result into a variable.
No help, sorry.
Roland
Torsten Wassum wrote:
>
> How can I pass a table name to a stored procedure and
> use it in a select command?
>
> Here is what I am trying to do:
>
> 1. Call the stored procedure and pass a tablename:
>
> EXECUTE PROCEDURE test ("table1")>
> 2. This would be the stored procedure:
>
> CREATE PROCEDURE test (tablename (CHAR(10))
> ...
> SELECT MAX (value)
> FROM tablename
> INTO max_value;> ...
> END PROCEDURE;
>
> It is not working the way it is listed here!
> Does anybody know how to do that?