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: inline view - = dynamic sql

Re: inline view - = dynamic sql

From: Erik Ykema <Erik.SIHTEVOMER.Ykema_at_xs4all.nl>
Date: Wed, 26 Mar 2003 20:34:45 +0100
Message-ID: <3e8200d6$0$49116$e4fe514c@news.xs4all.nl>


You indeed produced an inline view, although it is not what you wanted. What you are looking for is dynamic sql:
you want to build a sql-statement where the table to be selected from is given by the outcome of your 'inline view', i.e. another select statement. Please see
http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76965/c08s chem.htm#18122 (you need to have registered [for free] at otn.oracle.com) for the concept of an 'Inline View'.
Please see
http://download-west.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76939/adg0 9dyn.htm#24834. This might be a little overwhelming, as you need to construct first in a vachar2-variable your select-statement, then parse and execute it, and then perform various calls to dbms_sql-builtin pl/sql package in order to receive the outcome of your dynamic sql statment.

But it is worth having it in your toolbox. Also search asktom.oracle.com for perhaps an easy full example.
Good Luck,
Erik Ykema

"Hanne Iren Midttun" <hannem_at_tihlde.org> wrote in message news:Pine.LNX.4.21.0303261415540.1886-100000_at_colargol.tihlde.org...
> Hi,
> I have never before created an inline view (and right now it look like I'm
> never going to manage to create one either..) Can somebody please tell me
> what I'm doing wrong. (Oracle 8.1.7.4 on AIX 4.3)
>

> 4)
> select * from (select navn from metatab where kilde_id =1);

                           gives: the tablename geo_vei
                           so you hoped to achieve: select * from geo_vei

>
> --
> Hanne Midttun
> http://www.tihlde.org/~hannem
Received on Wed Mar 26 2003 - 13:34:45 CST

Original text of this message

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