Concat date and time to existing data Oracle


How to Concat Current date and time in Existing data present in table.


Sometimes we come across a scenario where we need to append some particular vaule or some time stamp to our existing data. Then concatenation concept of oracle can be used.                                                                                           Concat operator "||" is used to append / modify                                                                                         our data.

Lets consider one example out here :

Say we have one table PT_Employee_Info in "ABC" schema.

  • Employee_File_Name has a format i.e. OBJ.some 3 digit number. After 999, it will not be able to store more records in it. So to avoid this we can add time stamp to it.


Employee_IDEmployee_AgeEmployee_NameEmployee_File_Name
125RiteshOBJ.112
224SiaOBJ.212
327RakeshOBJ.356
428RajeevOBJ.409


update ABC.PT_Employee_Info set Employee_File_Name Employee_File_Name || '_' || Sysdate ;


Employe_IDEmployee_AgeEmployee_NameEmployee_File_Name
125RiteshOBJ.112_25-MAY-16
224SiaOBJ.212_25-MAY-16
327RakeshOBJ.356_25-MAY-16
428RajeevOBJ.409_25-MAY-16


Share on Google Plus

About Unknown

Howsstuff

0 comments:

Post a Comment