2014-08-28 2 views
1

Я пытаюсь выполнить процедуру с помощью Perl, как в:Oracle - Попытка выполнить 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

Вы просто отсутствует точка с запятой (;)

Try:

 BEGIN 
     update_cascade.on_table(:ts); 
     END; 

Код выглядит хорошо!

+0

спасибо. – TonyaLepski

Смежные вопросы