Skip to main content
Question

Using Parameters in END SQL

  • April 10, 2013
  • 6 replies
  • 26 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

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+59
  • 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