Nav

Inserting, Updating, and Deleting Data with the Database Connector

The connector also provides insert, update and delete operations. Just like the select operation, these operations support dynamism and parameterization by using embedded DataWeave transformations:


       
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<db:insert config-ref="dbConfig">
  <db:sql>
    INSERT INTO PLANET(POSITION, NAME, DESCRIPTION) VALUES (777, 'Pluto', :description)
  </db:sql>
  <db:input-parameters>
    #[
    {'description' : payload}
    ]
  </db:input-parameters>
</db:insert>
view rawinsert.xml hosted with ❤ by GitHub
<db:update config-ref="dbConfig">
  <db:sql>
    UPDATE PLANET SET DESCRIPTION = :description where POSITION = :position
  </db:sql>
  <db:input-parameters>
  #[
    {'description' : payload,
    'position' : 7,
    }
  ]
  </db:input-parameters>
</db:update>


<db:delete config-ref="dbConfig">
  <db:sql>
    DELETE FROM PLANET where POSITION = :position
  </db:sql>
  <db:input-parameters>
  #[
    {'position' : 7}
  ]
  </db:input-parameters>
</db:delete>