2014-08-28 67 views
1

我試圖執行使用Perl編寫的程序爲下執行procedue:甲骨文 - 嘗試用perl

my @tabs = qw!ACTOR ADDRESS CATEGORY CITY COUNTRY CUSTOMER FILM INVENTORY LANGUAGE STAFF STORE!; 
    for my $ts (@tabs){ 
    chomp $ts; 
     my $csr = $ora->prepare(q{ 
      BEGIN 
      update_cascade.on_table(:ts) 
      END; 
     }); 
$csr->bind_param(":ts", $ts); 
$csr->execute; 
} 

這將導致以下錯誤:

DBD::Oracle::st execute failed: ORA-06550: line 4, column 12: 
PLS-00103: Encountered the symbol "END" when expecting one of the following: 


    := . (% ; 
The symbol ";" was substituted for "END" to continue. (DBD ERROR: error possibly near <*> indicator at char 71 in ' 
      BEGIN 
      update_cascade.on_table(:ts) 
      <*>END; 
     ') [for Statement " 
      BEGIN 
      update_cascade.on_table(:ts) 
      END; 
     " with ParamValues: :ts='ACTOR'] at sakila_update_cascade.pl line 18. 
DBD::Oracle::st execute failed: ORA-06550: line 4, column 12: 
PLS-00103: Encountered the symbol "END" when expecting one of the following: 


    := . (% ; 
The symbol ";" was substituted for "END" to continue. (DBD ERROR: error possibly near <*> indicator at char 71 in ' 
      BEGIN 
      update_cascade.on_table(:ts) 
      <*>END; 
     ') [for Statement " 
      BEGIN 
      update_cascade.on_table(:ts) 
      END; 
     " with ParamValues: :ts='ACTOR'] at sakila_update_cascade.pl line 18. 

我內的SQLPlus執行它作爲下

exec update_cascade.on_table(:'ACTOR'); 

我試着用:

update_cascade.on_table('||:ts||') 

它沒有得到執行,並得到這個錯誤的Perl:

Can't bind unknown placeholder ':ts' (':ts') at sakila_mig.pl line 659. 

的DBD :: Oracle包位點的實例爲下:

my $test_num = 5; 
    my $is_odd; 

    $csr = $db->prepare(q{ 
    BEGIN 
    PLSQL_EXAMPLE.PROC_IN_INOUT(:test_num, :is_odd); 
    END; 
    }); 
    $csr->bind_param(":test_num", $test_num); 

    $csr->bind_param_inout(":is_odd", \$is_odd, 1); 
    $csr->execute; 

你的幫助非常感謝! Tonya。

回答

2

你只是缺少一個分號(;)

嘗試:

 BEGIN 
     update_cascade.on_table(:ts); 
     END; 

的代碼看起來不錯!

+0

非常感謝。 – TonyaLepski 2014-08-28 13:47:54