Question

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.

Was it helpful?

Solution

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']]'" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top