Geeks Talk

Prepare for your Next Interview




How can I get records in follwing format?

This is a discussion on How can I get records in follwing format? within the SQL forums, part of the Databases category; suppose in table named customer has a column named ename having values like james,john ,suji_paric,scott_tiger. i want retrieve the column value like james john suji scott...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-17-2008
Junior Member
 
Join Date: Mar 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
aurobinda.dalai is on a distinguished road
How can I get records in follwing format?

suppose in table named customer has a column named ename having values like james,john
,suji_paric,scott_tiger.

i want retrieve the column value like
james
john
suji
scott
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-17-2008
Expert Member
 
Join Date: Sep 2007
Posts: 614
Thanks: 22
Thanked 52 Times in 51 Posts
krishnaindia2007 is on a distinguished road
Re: How can I get records in follwing format?

Use the following statement

SQL> select substr(name,1,decode(instr(name,'_'),0,length(name),instr(name,'_')-1))
from test_data;

SUBSTR(NAME,1,DECODE
--------------------
james
john
suji
scott
Reply With Quote
  #3 (permalink)  
Old 05-22-2008
Contributing Member
 
Join Date: Apr 2006
Location: kolkata(now in noida)
Posts: 56
Thanks: 9
Thanked 3 Times in 2 Posts
bhaski is on a distinguished road
Re: How can I get records in follwing format?

there r many ways 2 do this

http://asktom.oracle.com/pls/asktom/...D:766825833740

or search google pivot query
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
pls let me know the answers for follwing lr questions vsmkreddy LoadRunner 1 05-16-2008 08:29 AM
Report output Format to pdf format krishnaindia2007 Oracle 2 02-05-2008 03:49 AM
Currency Format krishnaindia2007 Oracle 1 12-27-2007 02:46 AM
Format of Sysdate Geek_Guest Oracle 5 07-12-2007 06:04 AM
How can I display the records in specific format anandreddy.bv SQL 1 05-30-2007 05:50 AM


All times are GMT -4. The time now is 06:30 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved