寫個(gè)小工具來管理項(xiàng)目中的SQL腳本文件,當(dāng)主要代碼調(diào)試成功以后,使用ANT來處理時(shí)候遇到個(gè)問題,每次執(zhí)行都會(huì)報(bào)如下錯(cuò)誤:
BUILD FAILED
Java.sql.SQLException: ORA-06550: 第 1 行, 第 33 列:
PLS-00103: 出現(xiàn)符號(hào) "end-of-file"在需要下列之一時(shí):
:= . ( @ % ; not
明明都是正確的為什么使用ANT就會(huì)報(bào)錯(cuò)呢,查了一下資料,發(fā)現(xiàn)ANT默認(rèn)使用分號(hào)來作為一條SQL語句結(jié)束。導(dǎo)致存儲(chǔ)過程中的語句被分開執(zhí)行了。
解決辦法設(shè)置delimiter為"/":
<target name="runsqls" depends="init" description="run sql script">
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}" delimiter="/">
<classpath refid="classpath"/>
<fileset dir="sql-scripts">
<include name="*.sql"/>
</fileset>
</sql>
</target>
現(xiàn)在ok了,盡情享受吧。