simple quotes in dbproc
jean-michel OLTRA <[email protected]> Thu, 11 Sep 2003 22:32:19 +0200
| Newsgroups | gmane.comp.db.sapdb.general |
|---|---|
| Message-ID | <20030911203219.GA20421@espinasse> |
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