Oracle 11データベースでPL/SQLスクリプトを実行するためにsql-maven-pluginを使用しようとしています。スクリプトは(私の知る限り)有効なPL/SQLですが、実行は私PLS-00103エラーを与える:Maven:sql-maven-pluginを使用したPL/SQLスクリプトでエラーが発生するPLS-00103
SQLスクリプト:(drop_all_tables.sql)
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE MY_TABLE';
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
そして、私のプラグイン設定:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>oracle</groupId>
<artifactId>jdbc</artifactId>
<version>11.2.0.2.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>${jdbc.url}</url>
<username>${jdbc.username}</username>
<password>${jdbc.password}</password>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>src/main/resources/sql/drop_all_tables.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
そして、これは、Mavenの実行から出力された:
[ERROR] Failed to execute: BEGIN
EXECUTE IMMEDIATE 'DROP TABLE MY_TABLE';
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] ORA-06550: line 2, column 43:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
(begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << continue close current delete fetch lock
insert open rollback savepoint set sql execute commit forall
merge pipe purge
Mavenのエラーメッセージのコード出力は、スレッドの先頭に投稿したコードとよく一致しません。 – APC
ああ、本当に申し訳ありませんが、私はテーブル名を一般的なものに編集しました。エラー出力でそれをするのを忘れました - 今完了: – Guillaume
ポイントは、あなたが実際に実行しているコードです*あなたは何ですか?私たち*を示しています。実際のコードを表示しないと、構文エラーをどのように解釈すると思いますか? – APC