Topic
  • 1 reply
  • Latest Post - ‏2007-11-28T17:52:27Z by Kevin_Foster
SystemAdmin
SystemAdmin
228 Posts

Pinned topic how to send a tablename as parameter in SPL routines

‏2007-11-14T11:21:50Z |
Hi,
According to my requirement,I am writaing a procedure using SPL for dynamically create a table,dynamically drop that table . Means,I am sending table name as parameter, procedure created but while executing no result,
see the following eg. this procedure did not work .
CREATE PROCEDURE proc1(tabname varchar(20))

CREATE TABLE tabname(column1 char(10))

END PROCEDURE

pls help me
Advanced Thanks
Ramesh
Updated on 2007-11-28T17:52:27Z at 2007-11-28T17:52:27Z by Kevin_Foster
  • Kevin_Foster
    Kevin_Foster
    9 Posts

    Re: how to send a tablename as parameter in SPL routines

    ‏2007-11-28T17:52:27Z  
    The only way that I know of to do dynamic SQL in a SPL routine is through the Exec bladelet:

    http://www.ibm.com/developerworks/db2/zones/informix/library/demo/ids_exec.html
    As an alternative, I'd probably collapse all of this information into one table like this:

    create table mastertable (tabname varchar(20), column1 char(10));
    create index masteridx on mastertable (tabname, column1);

    especially considering that all of these "tables" have the same structure.

    -Kevin