Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL

 
James Daniel
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run Oracle SQL scripts via Ant. Everything works fine if they are plain SQL commands. If, the script includes both PLSQL and SQL commands, the script fails. The script runs fine in Toad. I assume Toad has a parser that differentiates between SQL and PLSQL. Has anyone heard of a way to mimic what Toad does in Ant? Any help would be greatly appreciated.

Jim
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim,
If you don't find a PLSQL task, you can always call TOAD through an OS script. Which Ant can call using the exec task.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Presumably your complex scripts consist of multiple statements on multiple lines. The Ant SQL Task has a bunch of optional configurations to do with processing of separators and (re)formatting of scripts - can you give us any more details on which options you have tried?
[ January 10, 2007: Message edited by: Frank Carver ]
 
James Daniel
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried a plain vanilla Ant call of SQL script. I do see that a "keepformat" switch. I will try that.
 
James Daniel
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still getting the error. Plain SQL scripts work but PLSQL fail.

Script I am trying to run:

begin
select count(*) from abc;
end;

Exception thrown:

java.sql.SQLException: ORA-06550: line 3, column 33:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ;

at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic