Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to avoid use of to_date and to_char ?

Hariharan STOct 22 2008 — edited Oct 22 2008
Hi All,

I have table 'sample ' with columns id (number ) and dte (timestamp ) .


CREATE TABLE SAMPLE ( ID NUMBER,DTE TIMESTAMP);

Sample Records like

INSERT INTO SAMPLE VALUES( 1,SYSDATE);
INSERT INTO SAMPLE VALUES( 2,SYSDATE);
INSERT INTO SAMPLE VALUES( 3,SYSDATE+1);
INSERT INTO SAMPLE VALUES( 4,SYSDATE+1);
INSERT INTO SAMPLE VALUES( 5,SYSDATE+3);


After inserting the records the dte will have both date and time.....
My Question is, How to fetch the records for the given date ( not time ) without using to_date,to_char or trunc functions from the table .
For Example,

select * from sample where dte = '22-OCT-2008' ;

Note : '22-OCT-2008' is not exactly a string ,use it as date datatype.


Regards,
Hariharan ST
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2008
Added on Oct 22 2008
5 comments
472 views