Skip to Content
0
Former Member
Mar 10, 2009 at 09:08 PM

JDBC Problem

19 Views

Hi,

I am have configured an IDoc to JDBC(DB) scenario.Since I need to update two table ,I have create two Statment's as shows in the below XML.

<?xml version="1.0" encoding="UTF-8" ?>

http://xxx.com/target">

<Statement1>

<dbTableName action="INSERT">

<table>Table1</table>

<Access>

<field1></field1>

<field2></field2>

</Access>

</dbTableName>

</Statement1>

<Statement2>

<dbTableName action="INSERT">

<table>Table2</table>

<Access>

<field1></field1>

<field1></field1>

</Access>

</dbTableName>

</Statement2>

</ns0:PartDetails_Request>

I tried inserting records and its works fine.I mean both the tables(Table1 and Table2) get the record.

But there is problem,

In some scenarios,

In payload ,Table1 has values and Table2 doesn't have any values.I mean Table2 payload is empty,so it generats a empty SQL Query and would try to INSERT the table,which is the error.So the data doesn't get inserted to both tables.

So I thought of some condition like ,only if Table1-field2 has some value, then I should insert a value to Table2 ,ie.only then the SQL Query for Table2 should be created.

else,

If a particular Idoc field has some value only then the SQL for table2 should be created.

So how can I achive this? So how to handel this null values in Table2?

Thanks,

Venu