bonjour,
I wrote a dbproc with dynamic SQL because one of the IN parameters is
used to modify the query. All queries contain a LIKE predicate.
Sth like:
CREATE DBPROC myproc (IN value VARCHAR(40), IN param VARCHAR(10))
RETURNS CURSOR AS
VAR stmt char(256);
whereclause char(100);
$CURSOR = MYCURSOR;
stmt = 'SELECT MYCURSOR(col1,...) FROM OWNER.TABLE WHERE';
CASE
WHEN param = 'val1' THEN whereclause = 'columname1 LIKE ' || '''' || /
value || '''';
WHEN param = 'val2' THEN whereclause = 'columname2 LIKE ' || '''' || /
value || '''';
... others WHEN THEN .....
END CASE;
... end of dbproc afterwards ......
which works ok.
It seems to me that this sequence of simple quotes is a little bit
ugly...but necessary to surround the string 'value' with simple quotes.
Is there a neater way to do this whith this kind of procedure ?
I know I could have use a value string like "''value''" but....
--
jean-michel
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general