Home » SQL & PL/SQL » SQL & PL/SQL » about dates
about dates [message #300876] Mon, 18 February 2008 07:43 Go to next message
msafana
Messages: 31
Registered: July 2007
Member
hi all,

i want one help,actually we will use ,

select * from emp where dt =to_Date('05/05/2004','mm/dd/yyyy')

for finding out that exact one date,but if we want to get more than one date to find then how the date function can be used like i have 2 dates ,6/6/2004,5/5/2006 then how the query can be written for that.

please help me,thank u.

Re: about dates [message #300878 is a reply to message #300876] Mon, 18 February 2008 07:49 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Use to_date for each string-representation of a date.
Re: about dates [message #300945 is a reply to message #300876] Mon, 18 February 2008 15:59 Go to previous messageGo to next message
Bill B
Messages: 1484
Registered: December 2004
Senior Member
Also try our "OR"
Re: about dates [message #301241 is a reply to message #300876] Tue, 19 February 2008 15:19 Go to previous messageGo to next message
doss_arun
Messages: 10
Registered: February 2008
Location: iselin, new jersey
Junior Member

hi, use the between & and


SELECT *
FROM xxx
WHERE yyy BETWEEN ( input from date )
AND ( input to date );
Re: about dates [message #301244 is a reply to message #300876] Tue, 19 February 2008 16:07 Go to previous messageGo to next message
scottwmackey
Messages: 505
Registered: March 2005
Senior Member
It's actually fairly straight forward, but I have a feeling that this is really not your question.
SQL> CREATE TABLE t (dt DATE);

Table created

SQL> INSERT INTO t VALUES(to_date('01-JAN-2000', 'DD-MON-YYYY'));

1 row inserted

SQL> INSERT INTO t VALUES(to_date('02-JAN-2000', 'DD-MON-YYYY'));

1 row inserted

SQL> INSERT INTO t VALUES(to_date('03-JAN-2000', 'DD-MON-YYYY'));

1 row inserted

SQL> SELECT *
  2  FROM t
  3  WHERE dt IN (to_date('01-JAN-2000', 'DD-MON-YYYY'), to_date('03-JAN-2000', 'DD-MON-YYYY'));

DT
-----------
1/1/2000
1/3/2000
Re: about dates [message #301306 is a reply to message #301244] Wed, 20 February 2008 00:38 Go to previous message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Don't put solution only hint or clue as requested in OraFAQ Forum Guide, "Responding to Posts" section:
Quote:
When responding to questions, if it is obviously a student with a homework assignment or someone else just learning, especially in the homework and newbies forums, it is usually best to provide hints or clues, perhaps links to relevant portions of the documentation, or a similar example, to point them in the right direction so that they will research and experiment on their own and learn, rather than providing complete solutions to problems. In cases where someone has a real-life complex work problem, or at least it may seem complex to them, it may be best to provide a complete demo and explanation.


Regards
Michel
Previous Topic: group
Next Topic: ORA-01810: format code appears twice
Goto Forum:
  


Current Time: Fri Dec 09 09:57:11 CST 2016

Total time taken to generate the page: 0.07159 seconds