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: dynamic join view

Re: dynamic join view

From: Jetlag <jetlag11235_at_yahoo.com>
Date: 23 Oct 2003 06:46:24 -0700
Message-ID: <2eeed00e.0310230546.43067e7a@posting.google.com>


Here is an example of what I would like to do.

   create or replace view V as
   select A.id, B.bb, C.cc
     from A, B, C
    where B.id (+) = A.id
      and C.id (+) = A.id;

   select id, bb
     from v;

I would like the execution plan for the select statement to _not_ involve table C because it is not needed in the results. However, now that I look at this, I realize that the database doesn't even know that this is the case ... unless there is at most ONE C.id for each A.id. As it turns out, this is the case in the query I am writing, so my question still stands ... I am just more doubtful now that it is possible.

I understand dynamic SQL, and *think* I understand variable cursors. But as far as I know, a variable cursor is accessed only through PL/SQL ... using FETCH INTO. Is there a way to incorporate a variable cursor directly into an SQL statement, treating it like an SQL view?

Thanks.

Received on Thu Oct 23 2003 - 08:46:24 CDT

Original text of this message

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