Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Execute an pl/sql statement from a Perl script

yenierFeb 4 2016 — edited Feb 4 2016

I need to execute a PL/SQL statement from a Perl script connecting to the Oracle database.

I have two options as following.

First situation:

my $sql_statement=

"BEGIN

sem_apis.create_rdfview_model( model_name => 'model_name', tables => NULL, r2rml_table_owner =>'DB_OWNER', r2rml_table_name => 'STAGE_TABLE' );

END;";

eval

{

my $sth = $db_conn->prepare($sql_statement);

$sth->execute();

};

$db_conn->rollback() and print $@ if $@;

$db_conn->commit();

Here the execution does not finish.

The second option is to change the value of $sql_statement variable

my $sql_statement="execute sem_apis.create_rdfview_model(model_name => 'model_name', tables => NULL, r2rml_table_owner => 'DB_OWNER', r2rml_table_name => 'STAGE_TABLE')";

And here the Perl script return the following execution error:

DBD::Oracle::st execute failed: ORA-00900: invalid SQL statement (DBD ERROR: OCIStmtExecute) [for Statement "execute sem_apis.create_rdfview_model(model_nam e => 'model_name', tables => NULL, r2rml_table_owner => 'DB_OWNER', R2RML_TAB LE_NAME => 'STAGE_TABLE')"] at ..../myScript.pl

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2016
Added on Feb 4 2016
1 comment
1,891 views