update tricks
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: update tricks

  1. #1
    Join Date
    Oct 2007
    Posts
    114

    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.

  2. #2
    Join Date
    Jun 2007
    Location
    Milwaukee,WI
    Posts
    27
    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


  3. #3
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,331
    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
  •  



Click Here to Expand Forum to Full Width