Marco van der Linden
Member³
I have the following code (I know it's copy/paste from Asktom):
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
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) };
}
}
}
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