Note that there are some explanatory texts on larger screens.

plurals
  1. POExecuting PL/SQL Begin/End procedure from Oracle JDBC thin driver
    primarykey
    data
    text
    <p>I am trying to create Oracle PL/SQL procedures and execute them via Oracle JDBC (thin driver). Here is the full PL/SQL script:</p> <pre><code>begin for i in (select owner, constraint_name, table_name from all_constraints where owner = 'SCHEMA' and status = 'ENABLED') LOOP execute immediate 'alter table SCHEMA.'||i.table_name||' disable constraint SCHEMA.'||i.constraint_name||''; end loop; end; / begin for i in (select table_name from all_tables where owner = 'SCHEMA') LOOP execute immediate 'truncate table SCHEMA.'||i.table_name||''; end loop; end; / begin for i in (select owner, constraint_name, table_name from all_constraints where owner = 'SCHEMA' and status = 'DISABLED') LOOP execute immediate 'alter table SCHEMA.'||i.table_name||' enable constraint SCHEMA.'||i.constraint_name||''; end loop; end; / </code></pre> <p>In java I am splitting on '/' so each begin end block is executed in a separate statement. The java code to execute the statement is:</p> <pre><code>CallableStatement c = dbc.getConnection().prepareCall(sqlStatement); c.executeUpdate(); </code></pre> <p>I'm receiving the following error:</p> <pre><code>java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended ORA-06512: at line 3 </code></pre> <p>How do I format this and execute the PL/SQL in JDBC?</p> <p><strong>Updated:</strong> To clarify, all three statements are executed without the '/' delimiter that is split on.</p> <p><strong>Updated:</strong> The oracle server is the following version: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload