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_ID | Employee_Age | Employee_Name | Employee_File_Name |
1 | 25 | Ritesh | OBJ.112 |
2 | 24 | Sia | OBJ.212 |
3 | 27 | Rakesh | OBJ.356 |
4 | 28 | Rajeev | OBJ.409 |
update ABC.PT_Employee_Info set Employee_File_Name = Employee_File_Name || '_' || Sysdate ;
Employe_ID | Employee_Age | Employee_Name | Employee_File_Name |
1 | 25 | Ritesh | OBJ.112_25-MAY-16 |
2 | 24 | Sia | OBJ.212_25-MAY-16 |
3 | 27 | Rakesh | OBJ.356_25-MAY-16 |
4 | 28 | Rajeev | OBJ.409_25-MAY-16 |
0 comments:
Post a Comment