[ 
http://issues.apache.org/jira/browse/OPENJPA-27?page=comments#action_12429502 ] 
            
Marc Prud'hommeaux commented on OPENJPA-27:
-------------------------------------------

This limitation can frequently be worked around by adding in "CAST" functions 
around the parameter: e.g., "SELECT * FROM PEOPLE WHERE ? = ?" will cause the 
error "A statement string to be prepared contains parameter markers as the 
operands of the same operator.", but "SELECT * FROM PEOPLE WHERE CAST(? AS 
INTEGER) = CAST(? AS INTEGER)" will execute fine. In many cases, we already do 
put in the CAST for literal parameters.

Could you post the offending SQL and the exception that it raises so we can see 
where it is going wrong?


> SQL Parameter markers generated for literals causes DB2 SQL error SQLCODE 
> -417(SQLSTATE 42609), 418(SQLSTATE 42610)
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-27
>                 URL: http://issues.apache.org/jira/browse/OPENJPA-27
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>            Reporter: Catalina Wei
>
> over usage of parameter markers for LITERALS causes DB2 SQL errors.
> Literals in the JP query if generated 'as is' in the pushdown SQL, can avoid 
> DB2 SQL errors.
> Simple predicates caused DB2 SQL errors: 
>     where substring(e.name, 1, 5) = 'Harry'
>    where mod(e.empid, 2) > 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to