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!

Reg: regexp_substr Format

User_JZKI6May 9 2021 — edited May 9 2021

Hi Team,
We have below dates data, we are trying to find No. of days between the dates using below query
Table.PNGSELECT Date_1, Date_2,
(to_date (DATE_2, 'YYYY-MM-DD hh24:mi:ss')-TO_DATE (DATE_1,'YYYY-MM-DD hh24:mi:ss'))
as DATE_DIFF,
(regexp_substr (to_date (DATE_2, 'YYYY-MM-DD hh24: mi: ss’)-TO_DATE(DATE_1,'YYYY-MM-DD hh24:mi:ss'), '[^.]+', 1, 1))
as NO_OF_days
from Table1
for 1st 2 rows we have to get 0 No. of Days instead of decimal value(633576388888) how we can achieve this can anyone assist.

Comments
Post Details
Added on May 9 2021
1 comment
71 views