ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Rogov" <andrey.ro...@gmail.com>
Subject Re: Passing date as string to IBATIS.
Date Sun, 09 Mar 2008 15:51:33 GMT
Hi Suhaib,
I am using oracle 10g and my iBatis works well,
here is

 select count(*)
   from projects.documents d
 where to_char( d.created, 'dd Mon yy' ) = to_char( #docdate#, 'dd Mon yy' )

log
Documents Date = Sun Mar 09 17:50:09 MSK 2008
DEBUG [http-8080-Processor24] java.sql.PreparedStatement debug-
{pstm-100004}
 PreparedStatement:  select count(*)  from projects.documents d   where
to_char( d.created, 'dd Mon yy' ) = to_char( ?, 'dd Mon yy'
)

DEBUG [http-8080-Processor24] java.sql.PreparedStatement debug-
{pstm-100004} Parameters: [2008-03-09 17:50:09.578]
DEBUG [http-8080-Processor24] java.sql.PreparedStatement debug-
{pstm-100004} Types: [java.sql.Timestamp]
DEBUG [http-8080-Processor24] java.sql.ResultSet debug- {rset-100005}
ResultSet
DEBUG [http-8080-Processor24] java.sql.ResultSet debug- {rset-100005}
Header: [COUNT]
DEBUG [http-8080-Processor24] java.sql.ResultSet debug- {rset-100005}
Result: [1]

Andrey.

2008/3/9, Suhaib <suhaib_tawalbeh@hotmail.com>:
>
>
> Hi all ,
> I am using  IBATIS  2.3.0 and oracle 10g.
>
> I have passed a date as string to select statments using IBATIS , the date
> format is dd Mon yy ,ex. 12 Mar 007, using IBATIS , there is no result
> return back from DB , but when i use any sql client I get the result from
> DB.
>
> SQL statement in IBATIS :
> The hireDate is String
>
> SELECT  name, id from employee
> where to_char(HIRE_DATE ,'dd Mon yy' ) = to_char(#hireDate#)
>
> SQL statement in SQL client:
> SELECT  name, id from employee
> where
>   to_char(HIRE_DATE ,'dd Mon yy' ) = '12 Mar 07'
>
> OR
>
> SELECT  name, id from employee
> where
>   to_char(HIRE_DATE ,'dd Mon yy' ) = to_char ( to_date,'12 Mar 07','dd Mon
> yy'),'dd Mon yy')
>
> regards
> Suhaib
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Passing-date-as-string-to-IBATIS.-tp15924757p15924757.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message