Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Problem

Re: SQL Problem

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 15 Mar 2005 20:34:17 GMT
Message-ID: <39ov69F6517raU3@individual.net>

It's not possible without PL/SQL except when you know that there are at most N values in the result's Col2.

However, you can write a user defined aggregate function that allows you to do a select statement without thinking about the PL/SQL behind.

See the example on my website:
http://www.adp-gmbh.ch/ora/sql/user_def_agg.html

hth
Rene

On 2005-03-15, Stephen Morton <news_at_stoneyard.co.uk> wrote:
> Please could someone help me with this problem. I have a table 'tab1'
> that looks this:
>
> Col1 Col2
> ---- -----
> A Alpha
> A Bravo
> B Charlie
> B Delta
>
> and a table 'tab2' that looks like this
>
> Col1 Col3
> ---- ----
> A 1
> B 2
>
> I would like produce this report from the tables:
>
> Col1 Col3 Col2
> ---- ---- ----
> A 1 Alpha Bravo
> B 2 Charlie Delta
>
> I can easily solve this problem using PL/SQL but wonder if I am
> missing a simpler SQL solution.
>
> I am using Oracle 8i and 9i.
>
> Thanks in advance, Stephen.

-- 
  Rene Nyffenegger
  http://www.adp-gmbh.ch/
Received on Tue Mar 15 2005 - 14:34:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US