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.
After updating to flyway 4.0 some stored procedures started to fail compilation when updated through flyway.
Managed to track problem to following
Test script to reproduce the issue
create or replace procedure Test_proc
is
begin
EXECUTE IMMEDIATE 'SELECT 123 num, 321 num2 '||'/*comment with,comma'||'*/ from dual order by num, num2';
end Test_proc;
/
the problem seems to be:
parser splits '/*comment with,comma' into several tokens, one of them is '/*comment
when it is handled by following piece of code inside SqlStatementBuilder
if (cleanToken.contains("/*")) {
delimitingTokens.add(TokenType.MULTI_LINE_COMMENT_OPEN);
handled = true;
} else if (cleanToken.startsWith("'")) {
delimitingTokens.add(TokenType.QUOTE);
handled = true;
}
' is ignored and as a result number of quotes is uneven.
which ultimately leads to
PLS-00103: Encountered the symbol "/" The symbol "/" was ignored.
Suggestions
modify method protected String simplifyLine(String line) in SqlStatementBuilder to add spaces around quotes(both ' and alternative) and may be around multiline comments /* */
or consider using regex to find required special tokens instead of splitting string
The text was updated successfully, but these errors were encountered:
What version of Flyway are you using?
4.0
What database are you using (type & version)?
Oracle 11g / 12c
What operating system are you using?
Windows 7
What did you do?
After updating to flyway 4.0 some stored procedures started to fail compilation when updated through flyway.
Managed to track problem to following
Test script to reproduce the issue
the problem seems to be:
parser splits
'/*comment with,comma'
into several tokens, one of them is'/*comment
when it is handled by following piece of code inside
SqlStatementBuilder
' is ignored and as a result number of quotes is uneven.
which ultimately leads to
PLS-00103: Encountered the symbol "/" The symbol "/" was ignored.
Suggestions
modify method
protected String simplifyLine(String line)
inSqlStatementBuilder
to add spaces around quotes(both ' and alternative) and may be around multiline comments /* */or consider using regex to find required special tokens instead of splitting string
The text was updated successfully, but these errors were encountered: