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

Home -> Community -> Usenet -> c.d.o.server -> Re: Question on Select Statement

Re: Question on Select Statement

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1997/08/22
Message-ID: <5tjtnt$2v4@camelot.dsccc.com>#1/1

You will have to create a PL/SQL block with a cursor. Read each detail and append to your output string.

Jerry Abramson (jerry_abramson_at_stratus.com) wrote:
: Chinh Nguyen wrote:
: >
: > Hi,
: > I have a master/detail relationship tables as below:
: >
: > create table Master(PrimKey number, Otherkey varchar2(20));
: > insert into Master values (1,'HELLO');
: > insert into Master values (2,'BYE');
: >
: > create table Detail(ForeignKey number, column1 number);
: > insert into Detail values (1, 200);
: > insert into Detail values (1, 300);
: > insert into Detail values (1, 400);
: >
: > commit;
: >
: > Question:
: >
: > Can I construct a select statement that will return "one and only one"
: > row containing all detail for this tables relationship.
: >
: > The idea result row shoud look like:
: >
: > 1 HELLO 200 300 400
: >
: > Thanks in advance for your help.
 

: I sure hope that you cannot do what you desire. A key aspect of
: relational
: databases is the notion of a result set. You can get a result set like
: this,
: and iterate over each detail value. For your desired result, how would
: you know how many detail columns to expect?
 

: detail
: - ----- ---
: 1 HELLO 200
: 1 HELLO 300
: 1 HELLO 400

: --
: ------------------------------------------------------------------
: Jerry Abramson
: Stratus Computer Corporation
: jerry_abramson_at_stratus.com [Work]

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Fri Aug 22 1997 - 00:00:00 CDT

Original text of this message

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