Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Querying across more than one database
Take a look at DATABASE LINKS.
-- Terry Dykstra Canadian Forest Oil Ltd. "Ivan K." <ivan_521521_at_yahoo.com> wrote in message news:4404E0F4.2070004_at_yahoo.com...Received on Tue Feb 28 2006 - 17:47:15 CST
> Possibly this is a dumb question.
>
> Can one query across more than one Oracle databases?
>
> For example, as defined in the listener.ora file,
> one might have the following databases:
>
> (GLOBAL_DBNAME = GEN2.leland.nwu.edu)
> (GLOBAL_DBNAME = GEN3.leland.nwu.edu)
> (GLOBAL_DBNAME = GEN4.leland.nwu.edu)
> (GLOBAL_DBNAME = GEN5.leland.nwu.edu)
>
> and then could a query be written which
> uses joins between tables of these different
> databases? Perhaps the SQL
> would look something like this:
>
> select
> asg_qry.aa_sequence_group_id q_group_id,
> sss_query.aa_sequence_id q_id,
> sss_subj.aa_sequence_id s_id,
> sim.score score
> from
> (GEN3).AASeq sss_query
> join (GEN3).AASeqSequenceGroup assg_qry on
> sss_query.aa_sequence_id = assg_qry.aa_sequence_id
> join (GEN3).AASeqGroup asg_qry on
> (
> assg_qry.aa_sequence_group_id = asg_qry.aa_sequence_group_id and
> (
> asg_qry.aa_sequence_group_id = 1554 or
> asg_qry.aa_sequence_group_id = 3339
> )
> )
> join (GEN3).Similarity sim on
> sim.query_id = sss_query.aa_sequence_id
> join (GEN4).AASeq sss_subj on
> sss_subj.aa_sequence_id = sim.subject_id
> order by
> asg_qry.aa_sequence_group_id,
> sss_query.aa_sequence_id;
>
> so that I am joining tables from
> databases GEN3.leland.nwu.edu and GEN4.leland.nwu.edu.
>
> Is such a thing possible with Oracle?
>
> Thank you for your help.
>
>