Re: ARGH - stored procedures
Posted in 1997
Davin,
On Thu, 24 Jul 1997 davin_harvey@dsti.co.uk wrote:
> Hi,
> Is there any way of writing a stored procedure that will drop a table=20
> based on a parameter passed into that procedure? What I want is
> CREATE PROCEDURE drop_table(tabname CHAR(18))
> DEFINE drop_str CHAR(80);> LET drop_str =3D 'DROP TABLE ', drop_str;
> EXECUTE IMMEDIATE drop_str;
> END PROCEDURE;
> except that EXECUTE is not allowed in a stored procedure=2E
> Any suggestions anyone?
> Ta
> Davin
>
> **********************************************************************
The only way I've found to do this is by writing a program and doing
"setuid" so the program runs as Informix. Be sure to limit the owner and
group so only certain people can run it. You can then dynamically create
and drop tables. The program could do exactly what you suggest above.
You might also want to add features to create indexes. For
example,
table_exec.4ge -d tabname -- Drop tabname
table_exec.4ge -c tabname -- Create tabname
table_exec.4ge -i tabname -- Create indexes for tabname
Again, be very careful who has access to the executable program! You might
also want to limit the values of "tabname" so it will only work on
certain tables.
Ron
Ron Flannery |
rflannery@one-point.com | President,
One Point Solutions | Michigan Informix User Group
http://www.one-point.com | http://www.zenacomp.com/miug/
voice=248.887.8470