-
update tricks
Hi Friends,
Oracle 9i DB
I have table EMP with column EMPNO (varchar2(10))
with values:
EMPNO
---------
FL-1000
FL-1001
FL2000
FL2001
How do I update the column to remove 'FL' and 'FL-'
I can not do it this way
update emp set empno=substr(empno,4,4) where empno like 'FL-%';
update emp set empno=substr(empno,3,4) where empno like 'FL%';
Can you please give a better way
Thanks a lot
Last edited by reeshe; 06-03-2008 at 10:52 PM.
-
Find substr(empno,1,3). If it's FL- then you can fire update emp set empno=substr(empno,4,4) where empno like 'FL-%'; and if it's FL1,2 what ever fire your second update. Do it using pl/sql
Akash
OCP 8i
-
my god no - use the replace functiomn (what its there for)
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
|