1 Reply Latest reply on Feb 4, 2016 7:31 PM by Sdas-Oracle

    Execute an pl/sql statement from a Perl script

    yenier

      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