Exforsys

Online Training

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 ...


Go Back   Exforsys > Database > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-05-2006, 01:16 PM
Junior Member
 
Join Date: Dec 2005
Posts: 10
sriharid is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-22-2006, 07:24 AM
Junior Member
 
Join Date: Nov 2006
Location: Bangalore, India
Posts: 12
sarunraj is on a distinguished road
Send a message via AIM to sarunraj Send a message via Yahoo to sarunraj
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-14-2006, 05:09 AM
Senior Member
 
Join Date: Apr 2006
Posts: 153
cyrus is on a distinguished road
sriharid did you try sarunraj suggestion. he haas given a good suggestion.You should get the output. Let us know the result.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-15-2006, 07:00 AM
Junior Member
 
Join Date: Dec 2006
Posts: 3
neelu.payola is on a distinguished road
SQL> select emp_id,substr(emp_name, instr(emp_name,' '))||' '||
substr(emp_name,0,instr(emp_name,' ')) from emp1;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new questions
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:39 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.