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