我正在尝试使用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错误:
无法在sakila_mig.pl第659行绑定未知占位符':ts'(':ts')。
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;
答案 0 :(得分:2)
您只是错过了分号(;)
尝试:
BEGIN
update_cascade.on_table(:ts);
END;
代码看起来不错!