SQL parametrized statement
Posted: Tue Jul 10, 2018 6:39 am
Hi,
I am sitting on this third day and still have not solution.
I need SQL statement with parameter for join with relation.
here
cStatementpolp := 'SELECT C_PROC,NAZPTK FROM RAUKN_OLP.DBF ORDER BY C_PROC WHERE (NAZPTK LIKE "'+pomtext3a+cislolv+pomtext3b+'" ESCAPE "'+pomtext4+'")'
when I define cislolv:="123", this works
Now I want to use parameter with question mark "?" but I do not know how to write quotation mark and apostrophe to make it work. I need replace cislolv with ?
This and many other version not work:
cStatementpolp := 'SELECT C_PROC,NAZPTK FROM RAUKN_OLP.DBF ORDER BY C_PROC WHERE (NAZPTK LIKE "'+pomtext3a+'?'+pomtext3b+'" ESCAPE "'+pomtext4+'")'
Note : I need create string where :
pomtext3a:="LVCH\_"
pomtext3b:="\_%"
and for example cislolv="123" , this must create string
LVCH_123_12131233...
ESCAPE I use because I have in table string field used character underline and for SQL this is wildcard for any one character, by ESCAPE i ignore it as wildcard.
I am sitting on this third day and still have not solution.
I need SQL statement with parameter for join with relation.
here
cStatementpolp := 'SELECT C_PROC,NAZPTK FROM RAUKN_OLP.DBF ORDER BY C_PROC WHERE (NAZPTK LIKE "'+pomtext3a+cislolv+pomtext3b+'" ESCAPE "'+pomtext4+'")'
when I define cislolv:="123", this works
Now I want to use parameter with question mark "?" but I do not know how to write quotation mark and apostrophe to make it work. I need replace cislolv with ?
This and many other version not work:
cStatementpolp := 'SELECT C_PROC,NAZPTK FROM RAUKN_OLP.DBF ORDER BY C_PROC WHERE (NAZPTK LIKE "'+pomtext3a+'?'+pomtext3b+'" ESCAPE "'+pomtext4+'")'
Note : I need create string where :
pomtext3a:="LVCH\_"
pomtext3b:="\_%"
and for example cislolv="123" , this must create string
LVCH_123_12131233...
ESCAPE I use because I have in table string field used character underline and for SQL this is wildcard for any one character, by ESCAPE i ignore it as wildcard.