Sri Rockz
Sri Rockz

Reputation: 85

how to set dynamic update query in mule

how to set dynamic update query in mule depends on payload input

sometimes we need to update just 1 column sometimes 2 columns depends on the input.

CREATE TABLE customers  
( customer_id number(10) NOT NULL,  
  customer_name varchar2(50) NOT NULL,  
  city varchar2(50)  
);  

Sometimes

UPDATE CUSTOMERS SET
CUSTOMER_NAME = 'sri'
where CUSTOMER_ID = 5;

Sometimes

UPDATE CUSTOMERS SET
CUSTOMER_NAME = 'Ram'
city= 'Delhi'
where CUSTOMER_ID = 5;

Upvotes: 0

Views: 840

Answers (1)

aled
aled

Reputation: 25812

That means that those are really different queries. Use one query for each case. Enclose the queries in appropriate choice router branches to determine which one to execute.

Dynamic queries can easily became a cause of SQL injection security vulnerabilities. I advise to avoid trying to do dynamic queries.

Upvotes: 1

Related Questions