-
How do I update partial value.
Example:
I have emp table with column hiredate, Hiredate has values like
11-AUG-98
10-OCT-88
12-OCT-88
11-OCT-89
.....
.....
I want to keep the date same but only change year where year = 88 to 2001.
so Result will be as shown below
11-AUG-98
10-OCT-01
12-OCT-01
11-OCT-89
.....
.....
Thanks in advance
-
update emp
set hiredate = add_months(hiredate,36)
where to_char(hiredate,'YYYY') = 1988;
-
sorry, 36 months is for 3 years, just put 156 instead of 36
-
Here is the easy method and Looks Good
Alter session set nls_date_format = 'DD-MON-YYYY';
Update Emp
Set Hiredate = Substr(Hiredate,1,7)||'9999'
Where substr(Hiredate,8) between 1988 and 2001;
This is fine and Provide the year in four digit year that you want to have.
then Issue
Alter session set nls_date_format = 'DD-MON-YY';
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|