Pregunta

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.

¿Fue útil?

Solución

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']]'" />
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top