Re: Stored Procedures
Posted in 1996
Dennis J Pimple <dennisp@informix.com> wrote: :Manoj Shroff wrote: :> :> Dear All, :> :> Is it possible to reference a variable in a select statement in :> a stored procedure, i.e :> :Afraid not. All the SQL has to be compiled at creation time, thus no :PREPARE in SPL, and thus no way to do "generic" SQL statements. But his example was as follows which sure should work (assuming he give a value to the TABLENAME variable somewhere in his first [snip]). If it doesn't whe would all have been out of luck. What doesn't work is as you say to prepare an arbitrary statement. There also is no way to do that in the spl language. manoj@future.dsc.dalsys.com (Manoj Shroff) wrote: : Is it possible to reference a variable in a select statement in :a stored procedure, i.e :create procedure test_one () :define TABLENAME CHAR(20); :[snip] :select * from systables :where tabname = TABLENAME <----------------+ :[snip] | :end procedure | : | : This is what I am talking about. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org