|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Combining dates
hi friends,
I am new to PL/SQL. I need to migrate the data from old to new database. In the old database i have table t_emp create table t_emp( EMP_YYYY VARCHAR2(4 BYTE), EMP_MM VARCHAR2(2 BYTE), EMP_DD VARCHAR2(2 BYTE), EMP_HH VARCHAR2(2 BYTE), EMP_TIME_MN VARCHAR2(2 BYTE), EMP_TIME_SS VARCHAR2(2 BYTE), EMP_TIME_HS VARCHAR2(2 BYTE), EMP_NO); ex: 1998 02 23 12 01 29 now i have one more new table in new database which contains Create table t_emp_new (start_date date); i need to load all the old historical data into new table using PL/SQL. How can i combine YYYY,MM,DD,HH,MN,SS,HS and insert as a single date. 02:23:1998 12:01:29 please help me regading this. chockey |
|
#2
|
|||||
|
|||||
|
Concatenate and then cast as date with to_date() function, something like
sql Code:
) compliment to the genius who decided to split the date into many varchar fields ... and no need to prepend a t to tables and a v to views, the database knows the difference and it's willing to tell it to you with it's metadata
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#3
|
|||
|
|||
|
Thank you so much.
i got it... |
|
#4
|
|||
|
|||
|
Hey,
Hey,
How can i get total date format Ex: 4/9/2008 2:16:54 PM In the above example i am able to get DDMMYYYY. In the old database HS is the hunderads od seconds. How can i combine hh:mi:ss with date????When i try to concatenate all hh,mi,ss i am getting only date DDMMYYYY Thank you chockey |
|
#5
|
||||
|
||||
|
Show us the actual query
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Combining dates |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|