Support Questions

Find answers, ask questions, and share your expertise

Can I call oracle plsql procedure after my processor PutDatabaseRecord finished

avatar
Explorer

Hi,

 

can someone help me to find solution for execute plsql oracle procedure after I finish putin record in my table in database. I have flow like this

LejlaKM_0-1644497154366.png

and when all job is done I have to execute procedure with max and min ID from this flow...

 

Thanks in advance

12 REPLIES 12

avatar
Explorer

Hi,

 

I am new in nifi so I don't know how to create and pass parameter with max and min value of my ID in source table to plsql procedure... Please help. My whole flow now looks like this

 

LejlaKM_3-1644567461396.png

 

 

I add another processor like this with two parameters

LejlaKM_0-1644567257501.png

and I pass those parametres to proseccor like this

 

LejlaKM_1-1644567371921.png

 

 

then I get error 

LejlaKM_2-1644567421065.png

 

Thank you

avatar

I would recommend do a test of the procedure without parameters by inserting test values directly to ensure it works.  This will do 2 things, first; confirm the procedure works, and second; indicate the issue with min/max is in the QueryRecord.  While testing flow, you should be able to see what the values of min/max are by inspecting the flowfile/attributes.

avatar
Explorer

Hi,

 

I have already tried and everything works when there are no parameters 

avatar

Ok great, then the issue is the QueryRecord.  In your flow I can see that min and max are both routes to PutSQ, not attributes of a single flowfile.


Have you inspected these flowfiles to see if they contain the correct values you need?   

Does it send 2 flowfiles to PutSQL?  

 

${min} and ${max} is an attribute syntax.  I believe you will need to get the min and max into a single flowfile and extracted as attributes to send to PutSQL

avatar
Explorer

Hi,

I made some changes....

Now, I have two separate flow files (one for insert and one for delete) which works fine. And in the end I put Output port.

LejlaKM_0-1644589417903.png

 

 

After that job is done, I need to execute plsql procedure from destination database, so I made another process group with input port and another flow

LejlaKM_1-1644589418008.png

 

Processor generate table fetch selecting max and min date from one table like this

LejlaKM_2-1644589418059.png

 

And after that I need those two values to pass to plsql procedure and I don't know how.

Query record processor look like this

LejlaKM_3-1644589418114.png

 

Last processor putsql look like this

LejlaKM_4-1644589418170.png

 

But this also doesn’t work

LejlaKM_5-1644589563090.png

because in last que i get two separate flow files one with min value and one with max....I think that is problem.... and I need one with two values that i can pass to plsql procedure

avatar

Excellent progress.  Can you try doing a single select to get both values?

 

Like this:  SELECT MAX(ID),MIN(ID) FROM FLOWFILE

 

If you could do that, then you could extract those values into 2 separate attributes, then feed that flowfile to the next processor in the flow.  Another alternative is to extractText for each value to an attribute, then MERGE 2 flowfiles into 1.

avatar
Explorer

Hi,

 

yes I can do this 

LejlaKM_0-1644595103097.png

And then I get 

LejlaKM_1-1644595139759.png

and when I call procedure it doesn't work 

LejlaKM_2-1644595183117.png

LejlaKM_3-1644595365740.png

 

Do I need more steps between query record and executing procedure?

 

avatar
Explorer

Hi,

As you can see I tried with Id instead date just to be sure that problem is not because format date, but it is not the problem. Problem is how to send those values to procedure.....