Re: Variable tab names
Posted in 2000
From: "Navdeep Virk" <NVirk@vsi-hq.com> > >I have a situation in which the table name has to vary . I need to >update around 50 tables . >say tab is an array loaded with table names >I want to do something like this >for i = 1 to 50 > update tab[i] set colname = foo where colname = foobar >next etc > >one possibility is to prepare a multi sql for the 50 ,but I want to >avoid that . > >1) I did RTFM for identifier as variable names ,it mentions regarding >col name not table names . >2) I know this statement needs to be prepared. >3) I tried to prepare selects >let g_scratch = " select customer_key,cupid from ", y clipped ,"= ? ;" >as also >let g_scratch = " select customer_key,cupid from ", y clipped >but at runtime the sql fails > >any suggestions . I'm guessing this is a stored procedure? You can't do dynamic SQL in a stored procedure. Sort of. If you have 9.x, you can download the dynamic SQL datablade from www.iuug.org, though. ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com