merge into using perl from array

From: Barbara Baker <barb.baker_at_gmail.com>
Date: Tue, 18 Aug 2009 14:58:37 -0600
Message-ID: <47a6f72b0908181358n3a199938u47fe73ad8688400c_at_mail.gmail.com>



Does anyone have an example that uses the "merge into" syntax where the source would be an array in perl instead of a "real" table? Is it possible? Oracle 9.2.0.7 Sun O/S 9 perl 5.8.5

Here's sorta what I'm trying to do:

merge into
  ffcst.user_auth tgt
using
  ad_mart.sales_dim_at_prod_reader src
on (src.sales_sid=tgt.sales_sid)
when matched then
  update set tgt.sales_rep_code = src.sales_rep_code when not matched
then
  insert (tgt.rep_first_name)
values ( src.rep_first_name)
;

I'm getting the max timestamp
$sth = $dbh->prepare( "

        SELECT  max(import_stamp) FROM plate_rpt
        " );

  unless ( $sth->execute() ) {
    $ResultMsg = "Select Max Timestamp from $db plate_rpt table failed";

    ToLog($log,$ResultMsg);
    return($ResultMsg,\_at_row);
    }
  _at_row = $sth->fetchrow();

Then I'm

     selecting records from plate_counts
     where to_char(stamp, 'YYYY-MM-DD HH24:MI:SS') > '$last_ts'

and now I want to merge/insert the records I've found, but they're in memory.

Thanks for any ideas. Let me know if I'm crazy. (well, ok, that ship has sailed)

Barb

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Aug 18 2009 - 15:58:37 CDT

Original text of this message