質問

Lets assume that emp-no has the value of 12345

I want to create a SQL query at runtime that will change

select * from emp where emp_no = '#[flowVars['emp-no']]'

to

select * from emp where emp_no = '12345'

What is the correct MEL syntax as I have to many ' in my MEL. I have tried using the escape character but no luck.

Kind Regards.

役に立ちましたか?

解決

Assuming you are using Mule JDBC transport, you do not need to quote the column value, so the correct version is:

select * from emp where emp_no = #[flowVars['emp-no']]

If your flowVars['emp-no'] is numerical and you really need the quotes, set the flowVars['emp-no'] to type String instead.

If you are not using Mule JDBC, and just want to set the example payload, use:

<set-payload value="select * from emp where emp_no = '#[flowVars['emp-no']]'" />
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top