@@ -0,0 +1,1787 @@
+import java.io.BufferedOutputStream;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.sql.Connection;%0Aimport java.sql.DriverManager;%0Aimport java.sql.SQLException;%0A%0Aimport oracle.dbtools.raptor.newscriptrunner.ISQLCommand;%0Aimport oracle.dbtools.raptor.newscriptrunner.ScriptParser;%0Aimport oracle.dbtools.raptor.newscriptrunner.ScriptRunner;%0Aimport oracle.dbtools.raptor.newscriptrunner.ScriptRunnerContext;%0A%0Apublic class ParseScriptRunOneAtATime %7B%0A%09  public static void main(String%5B%5D args) throws SQLException, IOException %7B%0A%09%09    Connection conn = DriverManager.getConnection(%22jdbc:oracle:thin:@//localhost:1521/XE%22, %22klrice%22, %22klrice%22);%0A%09%09    conn.setAutoCommit(false);%0A%0A        FileInputStream fin = new FileInputStream(new File(%22myfile.sql%22));%0A%09%09    ScriptParser parser = new ScriptParser(fin);%0A%09%09    %0A%09%09    ISQLCommand cmd;%0A%09%09    // #setup the context%0A%09%09    ScriptRunnerContext ctx = new ScriptRunnerContext();%0A%09%09    ctx.setBaseConnection(conn);%0A%0A%09%09    %0A%09%09    // Capture the results without this it goes to STDOUT%0A%09%09    ByteArrayOutputStream bout = new ByteArrayOutputStream();%0A%09%09    BufferedOutputStream buf = new BufferedOutputStream(bout);%0A%0A%09%09    %0A%09%09%09ScriptRunner sr = new ScriptRunner(conn, buf, ctx);%09%09    %0A%09%09%09while ( (  cmd = parser.next() ) != null ) %7B%0A%09%09%09%09// do something fancy based on a cmd%0A%09%09%09%09sr.run(cmd);%0A%09%09%09%09// check success/failure of the command%0A%0A%09%09%09%09String errMsg = (String) ctx.getProperty(ctx.ERR_MESSAGE);%0A%09%09%09%09if ( errMsg != null   )%7B%0A%09%09%09%09%09// react to a failure%0A%09%09%09%09%09System.out.println(%22**FAILURE**%22 + errMsg);%0A%09%09%09%09%7D%09%09%09%09%0A%09%09    %7D%0A%09%09%09%0A%09%09    String results = bout.toString(%22UTF8%22);%0A%09%09    results = results.replaceAll(%22 force_print%5Cn%22, %22%22);%0A%09%09    System.out.println(results);%0A%0A%09  %7D%0A%0A%7D%0A

Create ParseScriptRunOneAtATime.java