Exforsys
+ Reply to Thread
Results 1 to 4 of 4

sql

This is a discussion on sql within the Oracle Database forums, part of the Database category; hai can any one tell this query having the table emp emp_id emp_name 01 john paul 02 ravi kumar 03 ...

  1. #1
    sriharid is offline Junior Member Array
    Join Date
    Dec 2005
    Answers
    6

    sql

    hai
    can any one tell this query
    having the table emp
    emp_id emp_name
    01 john paul
    02 ravi kumar
    03 hari babu

    when retriving the record i want the query output of emp_name is

    paul john
    kumar ravi
    babu hari

    if any one knows this please reply me


  2. #2
    sarunraj is offline Junior Member Array
    Join Date
    Nov 2006
    Location
    Bangalore, India
    Answers
    16
    hi,

    select substr(emp_name,instr(emp_name,' ',2,1),length(emp_name))
    ||' '|| substr(emp_name,1,instr(emp_name,' ',2,1)) name1
    from emp

    i think this query will do it for you..

    hope it helps,

    regards
    Raj


  3. #3
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128
    sriharid did you try sarunraj suggestion. he haas given a good suggestion.You should get the output. Let us know the result.


  4. #4
    neelu.payola is offline Junior Member Array
    Join Date
    Dec 2006
    Answers
    3
    SQL> select emp_id,substr(emp_name, instr(emp_name,' '))||' '||
    substr(emp_name,0,instr(emp_name,' ')) from emp1;


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...