Mark and Joe ā Thanks for the quick replay ā that did the trick. Worked great.
From: Mark Payne <[email protected]<mailto:[email protected]>> Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Date: Wednesday, January 13, 2016 at 12:25 PM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: Re: PutSQL question Ralph, Hello. An easy way to do this is to use ReplaceText to set the content of the FlowFile. You can set the Replacement Strategy to "Always Replace" and set the Replacement Value to something like: INSERT INTO MY_TABLE (ID) VALUES ('${id}') You could also use SQL parameters (though it's slightly more involved), and use ReplaceText, setting the Replacement Value to: INSERT INTO MY_TABLE (ID) VALUES (?) This would then require you to use UpdateAttribute to create the necessary parameters. You would need to add the following attributes: sql.args.1.value => This is the value to insert, so ${id} sql.args.1.type => This will be the JDBC Type, which for a VARCHAR is 12. So you would add two user-defined properties with UpdateAttribute: Property Name Property Value -------------------- ---------------------- sql.args.1.value ${id} sql.args.1.type 12 Does this all make sense? Thanks -Mark On Jan 13, 2016, at 3:16 PM, Perko, Ralph J <[email protected]<mailto:[email protected]>> wrote: Hi I want to use the PutSQL processor to execute an insert statement. The use case is straightforward. I need to pull an id attribute from a JSON message and write it to a database. I am using EvaluateJSONPath to grab the id but Iām hung up on how to then pass the SQL statement as the content. I could put the SQL statement in a file to be loaded as content but I am wondering if there is a way to do this inline with the flow? Ideally I would have the content of the FlowFile be the SQL and pass in the id as a SQL parameter as mentioned in the documentation. Thanks for your help, Ralph
