You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR: Unable to parse statement in /home/i3/flyway/sql/V1_01__test.sql at line 1 col 1: Incomplete statement at line 1 col 1: CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED HW AUTHID CURRENT_USER AS ......
Since Flyway-6.1.1 in OracleParser class added method adjustBlockDepth. if ("BEGIN".equals(keywordText) || (("IF".equals(keywordText) // **<<<-- Here called context.increaseBlockDepth() and variable blockDepth incremented.<<<---** || "CASE".equals(keywordText) || "LOOP".equals(keywordText)) && !containsWithinLast(1, tokens, parensDepth, "END")) || ("TRIGGER".equals(keywordText) && containsWithinLast(1, tokens, parensDepth, "COMPOUND")) || (("AS".equals(keywordText) || "IS".equals(keywordText)) && ( containsWithinLast(4, tokens, parensDepth, "PACKAGE") || containsWithinLast(3, tokens, parensDepth, "PACKAGE", "BODY") || containsWithinLast(3, tokens, parensDepth, "TYPE", "BODY"))) ) { context.increaseBlockDepth(); } else if ("END".equals(keywordText)) { context.decreaseBlockDepth(); // **<<<--- never called because the END keyword does not occur in PLSQL code <<<---** } }
which causes an exception to be thrown from class Parser:
if (TokenType.EOF == tokenType && (parensDepth > 0 || blockDepth > 0)) { throw new FlywayException("Incomplete statement at line " + statementLine + " col " + statementCol + ": " + sql); }
Appreciate a speedy solution to this problem.
Can this type of plsql code be excluded from checking for block depth?
The text was updated successfully, but these errors were encountered:
codicuz
changed the title
Block Depth check broken CREATE JAVA statement
Block Depth check broken migration contains CREATE JAVA statement
Dec 18, 2019
Which version and edition of Flyway are you using?
Flyway from github, branch master.
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Command-line
Which database are you using (type & version)?
Oracle EE 12.2.0.1
Which operating system are you using?
Linux and many other distrs.
What did you do?
deploy migration with below code:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED HW AUTHID CURRENT_USER AS public class Welcome { public static String welcome() { if (false) { return "Welcome " + " World"; } else { return "Welcome simple world"; } } } /
DOC: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/CREATE-JAVA.html#GUID-69E13452-1F91-4F98-B154-CF5B1C198387
What did you expect to see?
migration is deployed
What did you see instead?
ERROR: Unable to parse statement in /home/i3/flyway/sql/V1_01__test.sql at line 1 col 1: Incomplete statement at line 1 col 1: CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED HW AUTHID CURRENT_USER AS ......
Since Flyway-6.1.1 in OracleParser class added method adjustBlockDepth.
if ("BEGIN".equals(keywordText) || (("IF".equals(keywordText) // **<<<-- Here called context.increaseBlockDepth() and variable blockDepth incremented.<<<---** || "CASE".equals(keywordText) || "LOOP".equals(keywordText)) && !containsWithinLast(1, tokens, parensDepth, "END")) || ("TRIGGER".equals(keywordText) && containsWithinLast(1, tokens, parensDepth, "COMPOUND")) || (("AS".equals(keywordText) || "IS".equals(keywordText)) && ( containsWithinLast(4, tokens, parensDepth, "PACKAGE") || containsWithinLast(3, tokens, parensDepth, "PACKAGE", "BODY") || containsWithinLast(3, tokens, parensDepth, "TYPE", "BODY"))) ) { context.increaseBlockDepth(); } else if ("END".equals(keywordText)) { context.decreaseBlockDepth(); // **<<<--- never called because the END keyword does not occur in PLSQL code <<<---** } }
which causes an exception to be thrown from class Parser:
if (TokenType.EOF == tokenType && (parensDepth > 0 || blockDepth > 0)) { throw new FlywayException("Incomplete statement at line " + statementLine + " col " + statementCol + ": " + sql); }
Appreciate a speedy solution to this problem.
Can this type of plsql code be excluded from checking for block depth?
The text was updated successfully, but these errors were encountered: