Created 06-21-2017 07:48 AM
We have a custom query that we wish to put inside the ExecuteSQL processor, but this one proves a bit tricky:
SELECT * FROM mytable AS OF TIMESTAMP TO_TIMESTAMP('${now():format('yyyy-MM-dd HH:mm:ss')}', 'YYYY-MM-DD HH24:MI:SS');
The processor is CRON driven where we run it every 15 minutes. The expression language inside the first single quotes is NiFi's expression language to get the current time in the format specified. Note that the expression language:
${now():format('yyyy-MM-dd HH:mm:ss')}
itself uses single quotes. I tried substituting double quotes for the Oracle query, but Oracle won't accept the syntax as valid. So how do we substitute the intended date-time string inside the first single-quotes?
Created 06-21-2017 08:47 AM
Why don t you stage the $now():format(...) in an UpdateAttribute processor first and pass the new variable to your SQL query ?
Created 06-21-2017 06:23 PM
The documentation says "The Expression Language allows single quotes and double quotes to be used interchangeably". Try double-quotes in your EL expression.