I'm a Sybase employee.  Yes, since you have Sybase you must have Sybase
Central, right?  Well, if you do then look up Component Integration Services
(CIS is what it is mostly known as).  You create a proxy table for the
oracle.  Note: you first need Direct Connect for Oracle installed to do
this. 

It looks like this   CIS<-->DCO<-->Oracle
Since you have Sybase, the database is already accessable.  Just set up your
sql.ini file up to accomodate.  Again, if you have Sybase I believe you know
what I'm saying.  (Or pay us BIG bucks and we will be glad to HeLp...)

-----Original Message-----
From: Thomas A. Lowery [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 09, 2002 7:29 AM
To: '[EMAIL PROTECTED]'
Subject: Re: Querying tables from Sybase and Oracle at the same time


Hello Tony,

On Tue, Apr 09, 2002 at 11:24:44AM +0100, Ho, Tony wrote:

> I was wondering if you could help me.
> I have table A in Oracle and table B in Sybase
> I want to use an SQL in my perl code to select from both tables A and B as
> follows:
>  
> select A.first_name, B.last_name
> from tables A, B
> where A.account = B.account
>  
> Is it possible to use DBI to do this ?
> If so, how can I go about it ?

Yes.  Depending on the size of the tables, you can import both
tables into DBD::AnyData.  I believe Jeff has table joining in his
current release.  This requires both tables to fit in memory.  ymmv

If the tables are too large, then you'll need a two  loop process.

prepare (sth A) table A select ...
prepare (sth B) table B select using a place holder for account

execute A
while ( rowA ... fetch) {
        execute B(rowA->account)
        while ( rowB ... fetch) {
                ...
        }
}

With bind columns and placeholders, it's not as "clunky".  It's not
fast, but will do what you want.

Again, depending on the requirements and table sizes, you could do the
above once adding the rows to a flatten table stored in one databases.

Tom

-- 
Thomas A. Lowery

Reply via email to