Hi! We are using Liquibase as our deployment software for our Oracle SQL scripts, by launching .sql files.
However, our developer has supplied us with a Java Source SQL script, which Liquibase was unable to deploy. It tried to validate the Java code which was inside, and therefore stopped with a exception.
For example:
Reason: liquibase.exception.DatabaseException: ORA-29536: badly formed source: Encountered “” at line 1070, column 51.
Was expecting one of:
“sql” …
“final” …
“assert” …
“boolean” …
“break” …
“byte” …
“char” …
“class” …
“continue” …
“do” …
“double” …
“false” …
“float” …
“for” …
“if” …
“int” …
“interface” …
“long” …
“new” …
“null” …
“return” …
“short” …
“super” …
“switch” …
“synchronized” …
“this” …
“throw” …
“true” …
“try” …
“void” …
“while” …
<INTEGER_LITERAL> …
<FLOATING_POINT_LITERAL> …
<CHARACTER_LITERAL> …
<STRING_LITERAL> …
…
“{” …
“}” …
“(” …
“;” …
“++” …
“–” …
This is the part of the code it has issues with:
public void createFromGraph( Graph source ) throws GeneratorException
{
if ( m_nodes == null )
{
m_nodes = new HashMap();
}
else
{
m_nodes.clear();
}
Iterator it = source.getNodes().values().iterator();
while ( it.hasNext() )
{
Node node = (Node) it.next();
Node newNode = node.copy();
// ulozi se odkaz na node ze ktereho vzniknul
newNode.setMergeMapping( node );
m_nodes.put( node.getIdCinnosti(), newNode );
}
And:
Unexpected error running Liquibase: Migration failed for changeset 201_NXT/20230711101542000000__nxt.generator.cesty_0.sql::17007320451315::datalite:
Reason: liquibase.exception.DatabaseException: ORA-29536: badly formed source: Encountered “:” at line 396, column 91.
Was expecting one of:
“)” …
“,” …
“++” …
“–” …
“=” …
“=" …
“/=” …
“%=” …
“+=” …
“-=” …
“<<=” …
“>>=” …
“>>>=” …
“&=” …
“^=” …
“|=” …
“?” …
“||” …
“&&” …
“|” …
“^” …
“&” …
“==” …
“!=” …
“instanceof” …
“<” …
“>” …
“<=” …
“>=” …
“<<” …
“+” …
“-” …
"” …
“/” …
“%” …
“.” …
“::” …
“[” …
“(” …
This is the part of the code it has issues with:
/**
* Funkce pro nastaveni typu cinnosti (J/Z)
*
* @param typ_cinnosti Typ cinnosti (J/Z)
*/
public void setTypCinnosti( String typ_cinnosti )
{
setTypCinnosti( ( typ_cinnosti != null ) && ( typ_cinnosti.length() > 0 ) ? typ_cinnosti.charAt( 0 ) : 'Z' ) ;
}
Our developer’s analysis is, that Liquibase is trying to validate the code against the SQL rules, despite it being Java code. Our solution was to deploy it via SQLPlus with set define off, which went without issues, so the code is correct.
We are deploying it via liquibase formatted sql with following parameters:
–liquibase formatted sql
–changeset datalite:17008476351298 endDelimiter:/ runOnChange:true stripComments:false
We have also tried to use stripStatements:false but no change whatsoever. Any clue what could be wrong? I suspect a Liquibase bug.