[ http://issues.apache.org/jira/browse/IBATIS-76?page=comments#action_59361 ] Claudio Martins commented on IBATIS-76: ---------------------------------------
I found that the problem is related to the <!CDATA[ tag. When I removed it, the dynamic substituions just went fine. Why is this happening? > Problems with Dynamic Queries > ----------------------------- > > Key: IBATIS-76 > URL: http://issues.apache.org/jira/browse/IBATIS-76 > Project: iBatis for Java > Type: Bug > Components: SQL Maps > Versions: 2.0.9 > Environment: JRE 1.4.2 > Reporter: Claudio Martins > > I have a dynamic query on my SqlMap xml file. When I try to execute it, I > receive a SQLException with the message : > --- The error occurred in com/globo/billing/conf/sql/SqlMapping-Cobranca.xml. > > --- The error occurred while applying a parameter map. > --- Check the select-emissao-recorrente-InlineParameterMap. > --- Check the statement (query failed). > --- Cause: java.sql.SQLException: ORA-00933: SQL command not properly ended > But when I remove the <dynamic> block, the SQL runs perfectly. Can anybody > help me? > <statement id="select-emissao-recorrente" > > parameterClass="com.globo.billing.core.daos.EmissaoRecorrenteDAO" > resultClass="com.globo.billing.core.daos.EmissaoRecorrenteDAO" > cacheModel="cache-Cobranca"> > <![CDATA[ > SELECT > INFO.ASSINATURA_ID as codigoAssinatura, > INFO.STATUS_NUM as statusAssinante, > PAG.TIPO_COBRANCA_ID as tipoCobranca, > PAG.MEIO_PAGAMENTO_ID as meioPagamento, > LOGIN.USERNAME_TXT as usernameAssinante, > PAG.DIA_VENC_NUM as diaVencimento, > ASSIN.TITULAR_DEPENDENTE_NUM as titularDependente > FROM > TB_GLB_ISP_INFO_ASSINATURA INFO, > TB_GLB_ISP_PAGANTE PAG, > TB_GLB_ISP_ASSINANTE ASSIN, > TB_GLB_ISP_LOGIN LOGIN > WHERE > INFO.ASSINATURA_ID = PAG.ASSINATURA_ID > AND INFO.ASSINATURA_ID = ASSIN.ASSINATURA_ID > AND LOGIN.USUARIO_ID = ASSIN.USUARIO_ID > AND ASSIN.TITULAR_DEPENDENTE_NUM = 1 > <dynamic> > <isGreaterThan prepend="AND" property="diaVencimento" > compareValue="0"> > PAG.DIA_VENC = #diaVencimento# > </isGreaterThan> > <isGreaterThan prepend="AND" property="tipoCobranca" > compareValue="0"> > PAG.TIPO_COBRANCA_ID = #tipoCobranca# > </isGreaterThan> > </dynamic> > AND EXISTS (SELECT 1 > FROM TB_GLB_ISP_SERVICO_PRESTADO SERV > WHERE > SERV.ASSINATURA_ID = INFO.ASSINATURA_ID > AND SERV.DATA_INICIO_DT < > #dataTerminoCompetencia:DATE# > AND SERV.STATUS_COBRANCA_ID IN (1, 2)) > ORDER BY > INFO.ASSINATURA_ID > ]]> > </statement> -- 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 - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira
