Skip to main content
bilbusra
Gold ⭐️
October 10, 2019
Solved

Apache Nifi Bind Variable- Oracle

Hi,

I have a Nifi workflow that puts data from MS SQL to Oracle.  I have some queries that I used " binding" such as 

 

...

where MUST.MID = ${MID} and not exists (select a_id from tbl_a where a_id = ${MID}).

 

But the variables behaves like "literal" variables on Oracle. (it runs everytime such as  where MUST.MID = 50 and not exists (select a_id from tbl_a where a_id = 50))

 

What can I do for binding in Oracle part?

 

Thank you in advance. 

bilbusra
bilbusraAnswer
Gold ⭐️
October 17, 2019

I found the solution: Create the procedure which takes parameter in Oracle side and use Execute SQL to run the procedure( give the flowfile attribute as the parameter of the procedure)

3 replies

bilbusra
bilbusraAuthor
Gold ⭐️
October 11, 2019

I mean is there any way to set a parameter with a flowfile attribute and also send the query as it is binded(such as MID = :B😛)

Translate
bilbusra
bilbusraAuthor
Gold ⭐️
October 11, 2019

How Can I use the attributes of flowfile as a setter parameter to Oracle bind variable?

 

Example 

 

variable Bdetail varchar(1000)
variable BMID NUMBER
variable BCont Varchar(1000)


:Bdetail := ${DETAILS}
:BMID := ${MID}
:BCont := '${CONTACT_TYPE}'


UPDATE TBLM SET Phone = :Bdetail

    WHERE MUSTERI_ID = :BMID
           AND :BCont = 'MOBILE'

 

Translate
bilbusra
bilbusraAuthorAnswer
Gold ⭐️
October 17, 2019

I found the solution: Create the procedure which takes parameter in Oracle side and use Execute SQL to run the procedure( give the flowfile attribute as the parameter of the procedure)

Translate