Skip to main content
Question

Using Parameters in END SQL


Forum|alt.badge.img+2

Hi

I'm having an issue using a User Paramater inside the END SQL with the Oracle Writer.

 

I can use it in the WHERE clause on the Reader no problem but using the same format on the END SQL is causing me some problem. I'm sure it is something simple that I've missed! 

Reader WHERE:

USERUPDATED = '$(P_USERNAME)'

Writer END SQL:

DELETE FROM DB_UPDATED WHERE USERUPDATED = '$(P_USERNAME)'

It literally tries to find the string $(P_USERNAME)

Here is the contrived example (yes I would normally do this in SQL!):

http://db.tt/kWQgcu3j

Did this help you find an answer to your question?

6 replies

david_r
Celebrity
  • April 10, 2013
Hi Mark,

 

 

I've experienced some of the same issues, although not necessarily at the same place as you do). It seems that FME is not always entirely consequent in the way it expands parameter macros.

 

 

The only solution I know of is to create a Python scripted parameter that returns the entire contents and then to bind it to to the desired setting using right-click / link to parameter.

 

 

Example python scripted parameter

 

 

username = FME_MacroValues["P_USERNAME"]

 

end_sql = "DELETE FROM DB_UPDATED WHERE USERUPDATED = '" + username + "'"

 

return end_sql

 

 

David

Forum|alt.badge.img+2
  • Author
  • April 10, 2013

Hi David 

Fast repsonse as always - Do you live on here ? :-)

Your suggestion was what was similar to something I thought of but thought there must be something simple I'd missed!

My workaround was a Private Parameter (not Python Scripted) configured:

DELETE FROM DB_UPDATED WHERE USERUPDATED ='$(P_USERNAME)'

and link this to the END SQL

Mark


david_r
Celebrity
  • April 10, 2013
Hi Mark,

 

 

your solution is equally elegant, but you've probably discovered by now that I am a big fan of Python in FME, so there you go ;-)

 

 

David

 

 

PS: it's a question of being efficient while FME does its thing :-)

Forum|alt.badge.img+2
  • Author
  • April 10, 2013

Have just realised it isn't a single query to execute :-( 

Might use a SQLExecutor and a trigger of Creator with Create at End = Yes 


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • April 16, 2013
Hi Mark,

 

You're correct that this doesn't work now. I'm not sure why but from my talks with the developers it seems that this could be implemented. So this is filed as PR#43215 and I will let you know when the fix is in place.

 

 

Regards

 

 

Mark

 

 

Product Evangelist

 

Safe Software Inc

Forum|alt.badge.img+2
  • Author
  • April 18, 2013
Hi Mark,

 

 

I mailed the Safe Support Team and got an answer confirming this. Thanks for the reply on here.

 

 

Mark

 

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings