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!

Getting date and time from a simple insert. What am I missing?

Shambo2904Aug 12 2020 — edited Aug 12 2020

Hi

I am on Oracle 12c and creating a simple table with date field and trying to get the date and time of when I created the insert .


Why is it bringing back '12-AUG-2020 00:00:00' for date and time and not '12-AUG-2020 07:17:40' which is when I did the insert into the table?

What am I missing?


Regards


SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 12 07:17:52 2020

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Wed Aug 12 2020 07:12:08 +01:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

create table test
( in_date date);

insert into test values (to_date(sysdate,'dd-mon-rrrr hh24:mi:ss'));

commit;


select to_char(in_date,'DD-MON-RRRR HH24:MI:SS') FROM TEST;


TO_CHAR(IN_DATE,'DD-
--------------------
12-AUG-2020 00:00:00

This post has been answered by Saubhik on Aug 12 2020
Jump to Answer
Comments
Post Details
Added on Aug 12 2020
7 comments
2,944 views