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!

Insert a timestamp into date and number field

user12953417Aug 30 2015 — edited Aug 31 2015

Hi All,

Could you please help in below two questions:

1) Want to insert a timestamp into date field ? As i can't able to change the table structure .

example:  Create table x1 (v_date date)

               insert into table x1 select to_timestamp(activity_date,'mm/dd/yyyy hh24:MI:SS')  as v_date from csct.products where rownum<=10  .It able to loads the data but without timestamp.

i,e select * from x1 --data without timestamp ....i don't want to do like select to_timestamp((v_date, 'mm/dd/yyyy hh24:MI:SS') fromx1 . Is there any way?

2)  Trying to insert date  and timestamp into number field . Requirement i need to have a timestamp in prod1.p_id table

    Create table prod1 (p_id number);

insert into prod1 (p_id)

SELECT TO_CHAR(TO_DATE(cust_date_id,'YYYYMMDD'),'DD-MON-YYYY HH:MI:SS') AS V_VALUE_X FROM csct.customer_detail where rownum<=10

---getting error invalid number.

Note: cust_date_id ---number datatype ---contains data like ---20140101 ,20140510, etc..

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2015
Added on Aug 30 2015
4 comments
3,877 views