This content has been marked as final. Show 3 replies
Welcome to the forum!
This forum is for SQL Develper questions only. Mark this question ANSWERED and repost it in the SQL and PL/SQL forum
SQL and PL/SQL
SELECT col1,col2 FROM bill WHERE
trunc (TO_DATE(time_stamp, 'yyyy/mm/dd HH:MI:SS AM') = trunc (TO_DATE('2012/01','yyyy/mm');
This only returns data for first day of the month and need data for a month.
Well a TRUNC without a format string only gives you one day. If you want to trunc to the month you need a 'MM' format string.
SELECT sysdate, trunc(sysdate), trunc(sysdate, 'MM'), trunc(TO_DATE('2012/01','yyyy/mm')) td from dual SYSDATE,TRUNC(SYSDATE),TRUNC(SYSDATE,'MM'),TD 10/30/2012 6:48:53 PM,10/30/2012,10/1/2012,1/1/2012
I am not following your response. .. I am trying to compare date stored in CHAR. Time stamp is in format of 'yyyy/mm/dd HH:MI:SS AM' and I need to select data for matching ‘yyyymm’
Mark this question ANSWERED.
Why are you still here? You already marked your question answered in the other forum yesterday after I ask you to post there.
Re: Where with to_date returms only one month data