Variable tab names
Posted in 2000
Topics: General Discussion
Hi, 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 . NSV
Navdeep we need SOMETHING to go on. What do you want to use for a front-end? What platform and version are you using (yes it matters)? Do you have ESQL/C | SDK, 4GL, D4GL? Do you want to do this in: interactive SQL, SPL, WHAT? Art S. Kagel Navdeep Virk wrote: > > Hi, > 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 . > > NSV