I've got sql file that contains sqlplus specific script: it includes / or ; as statement terminators, EXEC to execute stored procedures, etc.
I need to execute this script from java (jdbc) without the need for sqlplus.
sql ant task / maven sql plugin can't handle the different terminators or EXEC commands.
Do you know any good way to do so without running sqlplus ?
We've bumped into the same problem... In brief, there are no ready solutions for that: if you open Ant or Maven sources, you'll see they are using a simple regexp-based script splitter which is fine for simple scripts, but usually fails on e.g. stored procedures.
There are indeed ANTLR parsers for PL/SQL, such as Alexandre Porcelli's one—those are very close, but still not ready to be used as a drop-in solution.
We ended up writing yet another ad hoc splitter which is aware of some sqlplus commands like /
and EXIT
— it's still ugly, but works for most of our scripts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With