Mule-Creating dynamic where condition for sql query through DB connector

前端 未结 3 1261
终归单人心
终归单人心 2021-01-25 06:56

I need to create dynamic query wherein the where condition will be changed based on the request coming in to mule.The request will be always get with query parameter. Here goes

3条回答
  •  情话喂你
    2021-01-25 07:24

    Haven't tested this, but something like this. Check if the inboundProperty is there and build up the query programatically :

    SELECT * FROM USERS WHERE NAME = '#[message.inboundProperties.name]'  #[message.inboundProperties.gender !=null ? ' AND GENDER=' + message.inboundProperties.gender]  #[message.inboundProperties.age !=null ? ' AND AGE=' + message.inboundProperties.age]
    

提交回复
热议问题