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: How to include table from other schema in view?

Re: How to include table from other schema in view?

From: Nitin Dahiya <ndahiya_at_hotmail.com>
Date: Fri, 23 Jul 1999 20:46:52 +0200
Message-ID: <7nc70a$abj$5@pumba.class.udg.mx>


does this not work ???

create view myview as select * from otherschema.othertable where condition;

of course, you will need to be granted the select priviledge on otherschema.othertable.
maybe this is what is missing ?

regards,
nitin.

Christopher Allen <progplusSPAMBEGONE_at_gte.net> wrote in message news:YHql3.687$HF.18072_at_dfiatx1-snr1.gtei.net...
> Can anyone tell me how to make a view include a table stored in another
> schema (within the same database)? Creating a synonym doesn't help, and
the
> dblink is designed to reach into a different database...not a different
> schema. I'm sure it's something simple, but after poring over the
> documentation I haven't been able to find it.
>
> Here is an example of what I'm trying to do. It shows two small sample
> tables--one in each schema. Then, in the second schema, it shows a CREATE
> VIEW command which incorporates the table in the first schema. The
command
> fails. How do I make it work?
>
> Thanks.
>
> ___________________________________________
> connect schema1/pw_at_db_net8
> Connected.
> SQL> create table schema1_table (
> 2 schema1_col1 number,
> 3 schema1_col2 varchar2(20)
> 4 );
>
> Table created.
>
> SQL> create public synonym schema1_table for schema1.schema1_table;
>
> Synonym created.
>
> SQL> connect schema2/pw_at_db_net8
> Connected.
> SQL> create table schema2_table (
> 2 schema2_col1 number,
> 3 schema1_col1 number,
> 4 schema2_col2 varchar2(20)
> 5 );
>
> Table created.
>
> SQL> create view schema2_view as
> 2 select schema2_table.schema2_col1,
> 3 schema2_table.schema2_col2,
> 4 schema1.schema1_table.schema1_col2
> 5 from schema2_table,
> 6 schema1.schema1_table
> 7 where schema2_table.schema1_col1
> 8 = schema1.schema1_table.schema1_col1
> 9 ;
> schema1.schema1_table
> *
> ERROR at line 6:
> ORA-00942: table or view does not exist
>
> SQL>
>
>
Received on Fri Jul 23 1999 - 13:46:52 CDT

Original text of this message

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