cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with structure in JDBC

Former Member
0 Kudos

Hi everyone...

I´ve the following scenario JavaProxy <> XI <> JDBC, but the SQL statement that I´ve to create, in the key tag, how to represent the following condition...

UPDATE ... SET ... WHERE field1 = hisValue AND (field2 = 0 AND (field3 is null OR field3 > 0))

I try to create the tag in this way

...

but when the DBM execute the SQL statement gave me something like that

"field keyAND does'nt exist in table TABLE"

Somebody can help me with this???

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thank to all you...

The only problem using SQL_DML is in the construction of the SQL string because the action is UPDATE, the empty fields are ignored, but that's the way.

bhavesh_kantilal
Active Contributor
0 Kudos

> Thank to all you...

>

> The only problem using SQL_DML is in the construction

> of the SQL string because the action is UPDATE, the

> empty fields are ignored, but that's the way.

Hector,

Could not get this statement of yous. Can you please elaborate as this sounds to be an interesting observation.

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Hector,

If you are not able to crack the KEY field strcuture for your requirement, you can always use SQL_DML,

[code]<root>

<stmt>

<Customers action="SQL_DML">

<access> UPDATE Customers SET CompanyName=’$NAME$’, Address=’$ADDRESS$' WHERE CustomerID='$KEYFIELD$’

</access>

<key>

<NAME>Company</NAME>

<ADDRESS>Street 3 </ADDRESS>

<KEYFIELD>CO</KEYFIELD>

</key>

</Customers>[/code]

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

check with link's provided in this post.

<b>UPDATE ... SET ... WHERE field1 = hisValue AND (field2 = 0 AND (field3 is null OR field3 > 0))</b>

In your case the structure shud be like this:

<root>

<StatementName1>

<dbTableName action=”UPDATE”>

<table>realDbTableName</table>

<access>

<col1>val1</col1>

<col2>val2new</col2>

</access>

<key1>

<field1>hisValue</field1>

<key2>

<field2 compareOperation=”EQ”>0</field2>

<key3>

<field3 compareOperation=”EQ”> </field3>

</key3>

<key4>

<field3 compareOperation=”GT”>0</field3>

</key4>

</key2>

</key1>

</dbTableName>

</StatementName1>

Former Member
0 Kudos

Hi,

If you have some complex cquery to be executed you can use the following structure.

<StatementName6>

<anyName action=” SQL_QUERY” | “SQL_DML”>

<access>SQL-String with optional placeholder(s)</access>

<key>

<placeholder1>value1</placeholder1>

<placeholder2>value2<placeholder2>

</key>

</anyName >

</StatementName6>

In your case the action="SQL_DML".

give the query in the access element with place holders.

Then map the corresponding placeholders in the mapping. This might be easy in ur case.

Go thro the help link for more details:

http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

Regards,

P.Venkat

moorthy
Active Contributor
0 Kudos

Hi,.

XML document format should be exactly as mentioned in the blog-

http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

rgds,

Moorthy