Home » SQL & PL/SQL » SQL & PL/SQL » Need help in comparison of date...
icon9.gif  Need help in comparison of date... [message #185068] Sun, 30 July 2006 20:09 Go to next message
alexyap1984
Messages: 3
Registered: July 2006
Junior Member
i hv a problem on hand now that i need ur guys help....
example,i wan do display data between 12/2005 and 2/2006...
but it just display data for 12/2005 onli...
how can i display data from 12/2005 until 2/2006??
hope someone can help me here....
Re: Need help in comparison of date... [message #185069 is a reply to message #185068] Sun, 30 July 2006 20:28 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
Post the SQL query & the DESC of the tables involved here
How can we know what you are doing wrong when you don't show us what you are actually doing?
Re: Need help in comparison of date... [message #185070 is a reply to message #185068] Sun, 30 July 2006 20:34 Go to previous messageGo to next message
alexyap1984
Messages: 3
Registered: July 2006
Junior Member
IF :DATE_TXN = 02 THEN
IF TO_CHAR(:TXN_DATE,'YYYY') = :YEAR_TXN-1 AND TO_CHAR(:TXN_DATE,'MM') >= 11 THEN
IF TO_CHAR(:TXN_DATE,'YYYY') = :YEAR_TXN AND TO_CHAR(:TXN_DATE,'MM') = 1 THEN


the :date_txn is month and the :year_txn is year...
so 02 stand for feb...
and the :year_txn is 2006
Re: Need help in comparison of date... [message #185125 is a reply to message #185068] Mon, 31 July 2006 01:53 Go to previous message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
alexyap1984 wrote on Mon, 31 July 2006 03:09

how can i display data from 12/2005 until 2/2006??
Basically, if table column which stores date value is of a DATE datatype, it is quite simple:
SELECT * FROM your_table
WHERE date_column_value BETWEEN TO_DATE('12/2005', 'mm/yyyy')
                            AND TO_DATE('02/2006', 'mm/yyyy');
Code you provided suggests that it is about Forms Builder; is it? What are ":TXN_DATE" and ":YEAR_TXN" fields? Dates? Characters? If it is a character, it seems that this line

IF :DATE_TXN = 02 THEN

won't do much good as 02 equals 2 - if you need 02, you'll have to enclose it into the single quotes: '02'.
Previous Topic: Passing parameters
Next Topic: Help Needed Regarding the following Query
Goto Forum:
  


Current Time: Thu Dec 08 02:03:31 CST 2016

Total time taken to generate the page: 0.09677 seconds