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: SQL CURSOR

Re: SQL CURSOR

From: Paul G Young <pgy_at_magma.ca>
Date: Mon, 06 Jul 1998 20:02:01 GMT
Message-ID: <01bda918$afe56e80$ec05bfce@default>


A quick a dirty way of producing a non-normal report (if you have only a few parts) would be using the outer join a few times.

Let me emphasize: You would only want to do this is if there was a small natural limit of parts. Otherwise it's file processing with dbms_output statements from PL/SQL.

select t0.id, t0.head-line, t1.text, t2,text, t3.text, t4.text from doc t0

        doc_text t1,
        doc_text t2,
        doc_text t3,
        doc_text t4

where (t0.id = t1.fk_doc and t1.order = 1)
and    (t0.id = t2.fk_doc (+) and 2 = t2.order (+))
and    (t0.id = t3.fk_doc (+) and 3 = t3.order (+))
and    (t0.id = t4.fk_doc (+) and 4 = t4.order (+));


PGY



Mattias Malmgren <a2matmal_at_ulmo.stud.slu.se> wrote in article <359A416C.6721D5DF_at_ulmo.stud.slu.se>...
> I have got 2 tables
>
> doc:
> id head-line
> 1 head 1
> 2 head 2
>
> doc_text
> fk_doc order text
> 1 1 part 1 of doc 1
> 1 2 part 2 of doc 1
> 2 1 part 1 of doc 2
>
> I need to return a CURSOR that is:
>
> id head-line concat_text
> 1 head 1 part 1 of doc 1 part 2 of doc 1
> 2 head 2 part 1 of doc 2
>
> Can anyone help me to create a select-statement or a PL/SQL block that
> would
> create a CURSOR like that.
>
> Thanx in advance! / Mattias
>
>
Received on Mon Jul 06 1998 - 15:02:01 CDT

Original text of this message

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