oracle - Convert time stored as hh24miss to hh24:mi:ss -


I have a column in my table that will store time as hh24miss format, i.e. it 091315 < / Code> which is 9 minutes 13 minutes and 15 seconds, I need to convert it to HH 24: MI: SS and insert it with date column which is in the format YYYYMMDD . Just, the following column dates: 19940601 and time: 091315 to 01-Jan-94 09:13:15 .

You should not store dates in the form of stars, and time There is no need to store in a separate field. The second involves the time below (you need TIMESTAMP for seconds frames.)

If you are actually stuck with this schema, then you have two strings A DATE :

  to_date (date_column || time_column, 'YYYYMMDDHH24MISS')   

Then you can show that you Whatever format you want; Which you have shown:

  to_char (to_date (date_column || time_column, 'YYYYMMDDHH24MISS'), 'DD-Mon-RR HH 24: MI: SS')   

However, you have data on June, no.

But in fact, please re-use your schema again and use the appropriate data type, do not store the value as a star, you have no validity and there is no easy way to check that the value you submitted Really represent the valid date and time.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -