RE:$cursor
"Anhaus, Thomas" <[email protected]> Wed, 27 Aug 2003 15:13:33 +0200
| Newsgroups | gmane.comp.db.sapdb.general |
|---|---|
| Message-ID | <[email protected]> |
Jain wrote : >Hi, > here I want to use a dynamic query(changes depends on condition) for >$cursor. >eg: > str VARCHAR(2000); > str="select * from tablename"; ( This will change depends on condition) > SET $CURSOR = 'TEST'; > DECLARE :$CURSOR CURSOR FOR SELECT :str ; >but I am gettin error. >what to do to use a string (str) to the cursor declaration >Thanx in advance. Please try the following : str VARCHAR(2000); SET $CURSOR = 'TEST'; str='DECLARE ' || $CURSOR || ' CURSOR FOR ' || 'select * from tablename'; EXECUTE str; Regards, Thomas -- Thomas Anhaus SAP DB, SAP Labs Berlin [email protected] http://www.sapdb.org/ _______________________________________________ sapdb.general mailing list [email protected] http://listserv.sap.com/mailman/listinfo/sapdb.general