Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6CE66634228 for ; Thu, 2 Apr 2009 11:02:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 93050-08 for ; Thu, 2 Apr 2009 11:01:50 -0300 (ADT) Received: from mx1.hub.org (mx1.hub.org [200.46.208.106]) by mail.postgresql.org (Postfix) with ESMTP id 2C067633B49 for ; Thu, 2 Apr 2009 11:01:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from perseverance.services.encs.concordia.ca (perseverance-96.encs.concordia.ca [132.205.96.94]) by mx1.hub.org (Postfix) with ESMTP id 6F86C125AD5F for ; Thu, 2 Apr 2009 11:01:58 -0300 (ADT) Received: from cacao.encs.concordia.ca (emilu@cacao.encs.concordia.ca [132.205.47.225]) by perseverance.services.encs.concordia.ca (envelope-from emilu@encs.concordia.ca) (8.13.7/8.13.7) with ESMTP id n32E1rJm025084 for ; Thu, 2 Apr 2009 10:01:54 -0400 Message-ID: <49D4C551.3030702@encs.concordia.ca> Date: Thu, 02 Apr 2009 10:01:53 -0400 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Thunderbird 2.0.0.21 (X11/20090302) MIME-Version: 1.0 To: PostgreSQL SQL List Subject: ibatis with overlaps query Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on perseverance.encs.concordia.ca at 2009/04/02 10:01:54 EDT X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/11 X-Sequence-Number: 32357 Good morning, With ibatis, do overlap checking: (1) select (DATE #begin_date#, DATE #end_date#) overlaps (DATE '2008-01-01', DATE '2009-01-01') . #begin_date# is varchar . #end_date# is varchar Always get: ============ Cause: java.sql.SQLException: ERROR: syntax error at or near "$4" However, when I updated the query to (2) select (#begin_date#::DATE, #end_date#::DATE) overlaps (DATE '2008-01-01', DATE '2009-01-01') It works. I am bit confused why (1) does not work, but (2) does? -- Lu Ying