'No value provided for placeholder expressions

Despite setting flyway.placeholderReplacement=false I keep seeing error about no value provided for placeholder expression in sql by Flyway

ERROR: Unexpected error org.flywaydb.core.api.FlywayException: No value provided for placeholder expressions: & conditions. Check your configuration! at org.flywaydb.core.internal.database.oracle.pro.SQLPlusPlaceholderReplacer.replacePlaceholders(SQLPlusPlaceholderReplacer.java:132) at org.flywaydb.core.internal.util.line.PlaceholderReplacingLine.getLine(PlaceholderReplacingLine.java:36) at org.flywaydb.core.internal.database.ExecutableSqlScript.extractStatements(ExecutableSqlScript.java:156) at org.flywaydb.core.internal.database.ExecutableSqlScript.(ExecutableSqlScript.java:133) at org.flywaydb.core.internal.database.oracle.OracleSqlScript.(OracleSqlScript.java:61) at org.flywaydb.core.internal.database.oracle.OracleDatabase.doCreateSqlScript(OracleDatabase.java:126) at org.flywaydb.core.internal.database.Database.createSqlScript(Database.java:163) at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.getSqlScript(SqlMigrationExecutor.java:96) at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeInTransaction(SqlMigrationExecutor.java:109) at org.flywaydb.core.internal.command.DbMigrate.isExecuteGroupInTransaction(DbMigrate.java:312) at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:275) at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:244) at org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:53) at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:163) at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:160) at org.flywaydb.core.internal.database.Connection$1.call(Connection.java:145) at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:74) at org.flywaydb.core.internal.database.Connection.lock(Connection.java:141) at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:150) at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:160) at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:138) at org.flywaydb.core.Flyway$1.execute(Flyway.java:947) at org.flywaydb.core.Flyway$1.execute(Flyway.java:910) at org.flywaydb.core.Flyway.execute(Flyway.java:1238) at org.flywaydb.core.Flyway.migrate(Flyway.java:910) at org.flywaydb.commandline.Main.executeOperation(Main.java:161) at org.flywaydb.commandline.Main.main(Main.java:108) Build step 'Execute shell' marked build as failure Finished: FAILURE



Solution 1:[1]

flyway.placeholderReplacement=false is only for Flyway placeholders, not SQL*Plus placeholders.

To disable SQL*Plus-specific placeholders, you must include SET DEFINE OFF in your script.

Solution 2:[2]

I think, best way to resolve this error - it's override default prefix and suffix

flyway.placeholderPrefix=$${
flyway.placeholderSuffix=}

because disabling this functionality may be unacceptably for some reasons: using flyway variables, for instance.

Solution 3:[3]

Using spring boot, in application.yml. Add the below placeholderReplacement: false

 flyway:
    baseline-on-migrate: false
    sql-migration-prefix: V
    table: migration
    placeholderReplacement: false

This was happening, because i had in my .SQL migration file, HTML code with ${name}.

So it was trying to replace that! and i want it to be as is, to be inserted in the database.

Summary: in my case i want it always disabled, as i have no use of it

References: Possible Usages In Different Configuration

Solution 4:[4]

If your use case is similar to mine (you cannot disable placeholders and you cannot change the prefix), an alternative way is to break the placeholder value. Let's says you SQL is:

UPDATE table SET value = '${variable}';

You can avoid FlyWay picking up the placeholder by using something like:

UPDATE table SET value = '$' + '{variable}';

Solution 5:[5]

you can encode the whole string with UTF-8, then decode it when you need to use it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Axel Fontaine
Solution 2 hwak
Solution 3 shareef
Solution 4 Tihomir Meš?i?
Solution 5 CodeJonSnow