Skip to Main Content

SQL & PL/SQL

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!

Sql query to find records that has timestamp along with date

User_2KH5JJun 25 2020 — edited Jun 25 2020

Hi All,

I have a date column which has below value

ASUM_D_PYC

06/01/2009 1:00:00 AM

06/01/2010

06/01/2010 1:00:00 AM

06/01/2012 1:00:00 AM

06/01/2016

06/01/2020

06/01/2007

I would like to create  a query to find the columns that has time stamp value ( ie ones with 06/01/2009 1:00:00 AM )

CREATE TABLE  TEMP_JRNL

(

  ASUM_D_PYC  DATE

) ;

    Insert into  TEMP_JRNL

   (ASUM_D_PYC)

Values

   (TO_DATE('06/01/2009 01:00:00', 'MM/DD/YYYY HH24:MI:SS'));

Insert into  TEMP_JRNL

   (ASUM_D_PYC)

Values

   (TO_DATE('06/01/2010 01:00:00', 'MM/DD/YYYY HH24:MI:SS'));

Insert into  TEMP_JRNL

   (ASUM_D_PYC)

Values

   (TO_DATE('06/01/2012 01:00:00', 'MM/DD/YYYY HH24:MI:SS'));

COMMIT ;

  SELECT  * FROM   TEMP_JRNL;

ASUM_D_PYC

06/01/2009 1:00:00 AM

06/01/2010

06/01/2010 1:00:00 AM

06/01/2012 1:00:00 AM

06/01/2016

I tried using length. However it didnt help

SELECT  D   asum_d_pyc , LENGTH(asum_d_pyc )

    FROM TEMP_JRNL

    WHERE phdr_c_ein='030462301'

    GROUP BY   asum_d_pyc ;

Any thoughts?

This data inserted by 2 difference sources. One source inserts without timestamp and another with timestamp.

ThankYou

Rajesh

Comments
Post Details
Added on Jun 25 2020
4 comments
7,609 views