Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Java comments in Oracle CREATE JAVA statement #2611

Closed
codicuz opened this issue Dec 26, 2019 · 1 comment
Closed

Problems with Java comments in Oracle CREATE JAVA statement #2611

codicuz opened this issue Dec 26, 2019 · 1 comment

Comments

@codicuz
Copy link
Contributor

@codicuz codicuz commented Dec 26, 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?

Linuxs

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";
    }
  }
}
/

This plsql code compiles until Java comments are met

For example:

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED hw
AUTHID CURRENT_USER AS
public class welcome {
// if insert comment here <<<---
  public static String welcome() {
// or here <<<---
    if (false) {
      return "Welcome World";
    } else {
      return "Welcome simple world";
    }
  }
}
/

return
ERROR: Unable to parse statement in ... at line 4 col 4: Incomplete statement at line 4 col 4: this is comment

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED hw
AUTHID CURRENT_USER AS
public class welcome {
  public static String welcome() {
    if (false) {
// if insert commen here <<<---
      return "Welcome World";
    } else {
      return "Welcome simple world";
    }
  }
}
/

return
ORA-29536

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED hw
AUTHID CURRENT_USER AS
public class welcome {
    // this comment <<<---
  public static String welcome() {
    // and this comment <<<---
    if (false) {
    // and this comment <<<---
      return "Welcome World";
    } else {
      return "Welcome simple world";
    }
  }
}
/

This plsql code compiles

What did you expect to see?

migration is deployed

What did you see instead?

ERROR: Unable to parse statement in ... at line 4 col 4: Incomplete statement at line 4 col 4: this is comment

and

ORA-29536

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Jan 2, 2020

The comment, when not indented is being mistakenly picked up as a PL/SQL delimiter (when indented it works fine, as you have seen). I'll push out a fix (asap to the repo, and in v6.1.4) which tracks braces in Java code to spot this case/

@alextercete alextercete removed this from the Flyway 6.2 milestone Jan 2, 2020
@alextercete alextercete added this to the Flyway 6.1.4 milestone Jan 2, 2020
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants