Re: DROP TABLE Problem
Posted in 1998
Paolo Agati wrote:
> I'm running Informix SE 7.22 on SCO OpenServer 5.0.4. I want to remove
> a set of table from a database and I want to use a stored procedure.
> All the tables have names starting with "r_". I wrote the following
> procedure:
>
> create procedure rm_rel()> define qqqq char(255);
> foreach select tabname into qqqq from systables where tabname like "r_%"
> drop table qqqq;> end foreach
> end procedure;
>
> but I received the following report:
> SQL error = -206 ISAM error = -111 error string = = "qqqq"
-206: no such table or words to that effect
> Am I missing something?
Yup -- what you're trying to do is called Dynamic SQL,
and you cannot do Dynamic SQL in SPL (Stored Procedure Language).
The table names in SPL are fixed when the SP is created.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix -- see http://www.perl.com/CPAN
#include <disclaimer.h>