Copy link to clipboard
Copied
Hi All,
Here is my problem,
I have a user defined function, which will give me the output as " table.column = <cfqueryparam cfsqltype = 'cf_sql_varchar' value = 'test'>;
but when i pass this as my where clause in the query.
I always get missing experssion (00936) error.
When I ON the debug information in CF, I copied the query its running;
any help would be highly appreciated.
I have tried replacing this double quotes with single quotes using Rereplace and replace function; tried preservesinglequotes(); all are returning the same error.. May be I'm missing something.
THe below is the query formed; and its the one I get when I on the debug information (sql)
SELECT * FROM SHOP_FINDINGS WHERE ROWNUM<=20 AND (OPER_NAME = <cfqueryparam cfsqltype='CF_SQL_VARCHAR' value='IN STOCK'> )
I m using CF 9 and Apache server.
Copy link to clipboard
Copied
59 views No reply.:(
I need some help ..
Copy link to clipboard
Copied
<cfqueryparam> is normally used when you want to sanitize user input (URL or Form scope data etc) that is passed to a database query. In this case the string "IN STOCK" is hard-coded, so why not just use:
SELECT * FROM SHOP_FINDINGS
WHERE ROWNUM<=20 AND OPER_NAME = 'IN STOCK'
Does that SELECT statement work? Also, try specifying the column names in the SELECT, rather than using the * wildcard. The parentheses are not needed in your statement either I don't think. This error normally occurs when you specify a missing column name or wildcard, or if a bracket/comma is missing or doesn't match etc. Re-check the query and write a test template to just issue one query to test it perhaps.
Copy link to clipboard
Copied
Hi Tribute,
Thanks!!
FOr an example, I made the value as "In Stock" but actually it was the user input.
selecting the columns dint work:(
Yes I m using the test template only; i have made the function and query separately and trying it but still in vain.
Copy link to clipboard
Copied
Can you please post your code in its entirety? Please also try using "cf_sql_char" as the sql type and give that a shot. Also, try omitting the cfsqltype and see what error, if any, that gives.