On Fri, 5 Feb 1999 soty@canada.com wrote:

> Dear Mr. Ari Kaplan: 
>
> I have checked your Oracle web site that is useful for our beginners.  
>
> However, I would like to know how to create a procedure that have to combine
> tables. 
> Example:
>
> tableA 1:2 tableB 1:2 tableD 1:2 tableE
> tableC 1:2 tableE
>
> tableA col1
>        col2 xx
>
> tableB col1
>        col4
>
> tableC col5
>        col6 xx
> 
> tableD col4
>        col7
>
> tableE col5
>        col7
>        col8 xx
> 
> Susan
>
You can make a simple SQL statement by using WHERE clauses in the select.

For your example:

SELECT * FROM tableA, tableB, tableC, tableD, tableE
WHERE tableA.COL1 = tableB.COL1 AND
      tableB.COL4 = tableD.COL4 AND
      tableC.COL5 = tableE.COL5 AND  
      tableD.COL7 = tableE.COL7;

To put this in a procedure, I assume you mean PL/SQL. If so, then you can
declare the above as a cursor.


-Ari Kaplan
Independent Oracle DBA Consultant

<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->
<-> For 265+ Oracle tips, visit my Web Page:                      <->
<->                                                               <->
<->             www.arikaplan.com                                 <->
<->                                                               <->
<->             email: akaplan@interaccess.com                    <->
<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->

Back to Ari Kaplan's Home Page "../index.htm"> Back to Ari Kaplan's Home Page