Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: simple problem
Raj,
Is this what you meant and what you would get?
SQL> get 1
1 select m.id, cast(multiset(select fname
2 from t s 3 where s.id = m.id) as mystrtype) as fnamelst4 from t1 m
---------- -------------------------------------------------- 1 MYSTRTYPE('RAM', 'SHAM', 'PAT') 2 MYSTRTYPE('MAN', 'JOHN')
Chaim
"Jamadagni, Rajendra" <Rajendra.Jamadagni_at_espn.com>@fatcity.com on 08/20/2002 04:28:29 PM
Please respond to ORACLE-L_at_fatcity.com
Sent by: root_at_fatcity.com
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc:
create or replace mystrtype is table of varchar2(50)
/
select field1, cast(multiset(field2) as mystrtype)
from my_table
group by field1
/
HTH
Raj
Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.
QOTD: Any clod can have facts, but having an opinion is an art!
-----Original Message-----
Sent: Tuesday, August 20, 2002 3:34 PM
To: Multiple recipients of list ORACLE-L
Here's an answer I posted to a similar question a few weeks ago.
HTH Tony Aponte
I hope this is not to late for you. Anyway, this questions comes up often. Below is the solution to pivot rows for up to 12 values of field1. Just adjust to fit your range of values.
HTH
Tony Aponte
Home Shopping Network, Inc.
create table tab1 (field1 number,field2 varchar2(30)); insert into tab1 values( 1,'RAM');
insert into tab1 values( 1,'SHAM'); insert into tab1 values( 1,'PAT'); insert into tab1 values( 2,'MAN'); insert into tab1 values( 2,'JOHN');
SELECT
g1
,MAX(DECODE(line_no,01,value,NULL)) || MAX(DECODE(line_no,02,value,NULL)) || MAX(DECODE(line_no,03,value,NULL)) || MAX(DECODE(line_no,04,value,NULL)) || MAX(DECODE(line_no,05,value,NULL)) || MAX(DECODE(line_no,06,value,NULL)) || MAX(DECODE(line_no,07,value,NULL)) || MAX(DECODE(line_no,08,value,NULL)) || MAX(DECODE(line_no,09,value,NULL)) || MAX(DECODE(line_no,10,value,NULL)) || MAX(DECODE(line_no,11,value,NULL)) || MAX(DECODE(line_no,12,value,NULL))
G1 MAX(DECODE(LINE_NO,01,VALUE,NU 1 RAMSHAMPAT 2 MANJOHN
-----Original Message-----
[mailto:RShankar1_at_CHN.COGNIZANT.COM]
Sent: Thursday, July 18, 2002 4:35 PM
To: Multiple recipients of list ORACLE-L
Hi Friends,
I just need a help in a sql . I am having rows in a table as
follows
Field1(ID) Field2(NAME)
1 RAM 1 SHAM 1 PAT 2 MAN 2 JOHN
Now i want the output to be as follows
FIELD1 FIELD2
Thanks in advance.
Regards,
Shankar
-----Original Message-----
Sent: Tuesday, August 20, 2002 9:53 AM
To: Multiple recipients of list ORACLE-L
Hi Lists!
I have one simple problem. My query is following
SELECT SOD.DESCRIPTION
FROM
SO_TRN_DETAIL SOD
WHERE
SOD.SO_TRN_ID =90
and result is :
PREM_NET
TAX_SPF
TAX_SUR
FEE_PDCR
FEE_INSP
PREM_GROSS
COM_GROSS
COM_PDCR
I want to concatenate all strings in a single string and want to display
as a single record using SQL. I had seen solution somewhere but i can not
search in archive.
How to do that?
Thanks in advance ...
Shishir Kumar Mishra
Agni Software (P) Ltd.
www.agnisoft.com
(See attached file: ESPN_Disclaimer.txt)
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Chaim.Katz_at_Completions.Bombardier.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed Aug 21 2002 - 13:18:39 CDT
- application/octet-stream attachment: ESPN_Disclaimer.txt
![]() |
![]() |