PDA

View Full Version : Oracle 10g TO_DATE problem



tom123
Feb 1st, 2007, 11:39 AM
Hi,

I have the following query which executes fine and returns three rows when run from SQLPlus. Promlem is that when run from a cgi script in perl nothing is returned.



SELECT gv_vote_id,
gv_group_id,
mg_group_name,
gv_title, gv_description,
TO_CHAR(gv_start_date,'DD-MON-YYYY HH24:MI'),
TO_CHAR(gv_end_date,'DD-MON-YYYY HH24:MI'),
gv_mail_to
FROM group_vote,
group
WHERE mg_group_code = gv_group_id
AND TO_DATE(gv_start_date,'DD-MON-YYYY') < TO_DATE(SYSDATE,'DD-MON-YYYY')
AND TO_DATE(gv_end_date,'DD-MON-YYYY') = TO_DATE(SYSDATE+1,'DD-MON-YYYY')
AND gv_published = '1'
AND gv_active = '1'

If i remove the line TO_DATE(gv_start_date,'DD-MON-YYYY') < TO_DATE(SYSDATE,'DD-MON-YYYY'), and replace TO_DATE(gv_end_date,'DD-MON-YYYY') = TO_DATE(SYSDATE+1,'DD-MON-YYYY') with TO_CHAR function, then it works fine (in script and SQLPlus)!!

gv_start_date and gv_end_date both have "Date" datatype.

Thanks in Advance

kyra13
Aug 3rd, 2011, 02:22 PM
Oh, why nobody answered, I have exactly the same problem:(
May be you tom123 have already fixed it up??