RE: Multiple statements within one $dbh-do()

2007-08-15 Thread Loo, Peter # PHX
Thanks.  I don't know what I did wrong the first time, but now it is
working.  Thanks again.
 
Peter

-Original Message-
From: Garrett, Philip (MAN-Corporate)
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 14, 2007 5:25 PM
To: Loo, Peter # PHX; dbi-users@perl.org
Subject: RE: Multiple statements within one $dbh-do()

Loo, Peter # PHX wrote:
 Hi,
 
 I am trying to execute two SQL statements within one call to
 $dbh-do() and Perl DBI is not happy.
 
 Here is a sample call:
 
 $sql = qq{delete from some_table
   where  condition_one
   andcondition_two;
   insert into some_table (col_1, col_2, col_3)
   select col_1, col_2, col_3
   from   another_table
   where  condition_one
   andcondition_two;};
 
 Is this possible?
 
 I have used multiple statements in the ODBC driver but have not done 
 so in the Oracle driver.  Oracle driver is not working.


With Oracle, you can use an inline PL/SQL block:

$sql = qq{
begin
   delete from ...;
   insert ...;
end;
};

- Philip


This E-mail message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not
the intended recipient, please contact the sender by reply E-mail, and
destroy all copies of the original message.


Multiple statements within one $dbh-do()

2007-08-14 Thread Loo, Peter # PHX
Hi,
 
I am trying to execute two SQL statements within one call to $dbh-do()
and Perl DBI is not happy.
 
Here is a sample call:
 
$sql = qq{delete from some_table 
  where  condition_one 
  andcondition_two; 
  insert into some_table (col_1, col_2, col_3) 
  select col_1, col_2, col_3 
  from   another_table
  where  condition_one
  andcondition_two;};
 
Is this possible?
 
I have used multiple statements in the ODBC driver but have not done so
in the Oracle driver.  Oracle driver is not working.
 
Thanks.
 
Peter


RE: Multiple statements within one $dbh-do()

2007-08-14 Thread Garrett, Philip \(MAN-Corporate\)
Loo, Peter # PHX wrote:
 Hi,
 
 I am trying to execute two SQL statements within one call to
 $dbh-do() and Perl DBI is not happy.
 
 Here is a sample call:
 
 $sql = qq{delete from some_table
   where  condition_one
   andcondition_two;
   insert into some_table (col_1, col_2, col_3)
   select col_1, col_2, col_3
   from   another_table
   where  condition_one
   andcondition_two;};
 
 Is this possible?
 
 I have used multiple statements in the ODBC driver but have not done
 so in the Oracle driver.  Oracle driver is not working.


With Oracle, you can use an inline PL/SQL block:

$sql = qq{
begin
   delete from ...;
   insert ...;
end;
};

- Philip