Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: inline view - = dynamic sql
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