Problems creating procedure as language java in command window

I have the following code (I know it's copy/paste from Asktom):

Code:
create or replace
   and compile java source named "DirList"
as
import java.io.*;
import java.sql.*;

public class DirList
{
public static void getList(String directory)
                   throws SQLException
{
    File path = new File( directory );
    String[] list = path.list();
    String element;

    for(int i = 0; i < list.length; i++)
    {
        element = list[i];
        #sql { INSERT INTO DIR_LIST (FILENAME)
               VALUES (:element) };
    }
}

}
When I execute it in a SQL window it compiles smoothly. If I open the editor in the command window and copy/paste it in there it executes smoothly as well.

If I open the editor in the command window and copy/paste it in there it executes smoothly as well.

But when I save the code as sql file and try to run it as script I get:
ORA-29536: badly formed source: Encountered "" at line 2, column 1.
Was expecting:
";" ...

This does not happen in SQL*Plus 9i
 
Did this ever get fixed? I have version 6.0.5.931

I get a slightly different problem.

I open a command window, and @ execute my big compile script. When I reference (using @@) a .jsp file, it compiles, but gives me java compilation errors. I do a show errors, and it gives me errors on lines where there are no errors (see next paragraph).

I then pull it up in a package window, hit F8, and it compiles - no errors!
 
Back
Top