on 03-23-2006 7:37 AM
Hallo everybody,
asuming I have to DB tables:
a) <b>CUSTOMER</b> with fields
- CUSTOMER_ID
- NAME
b) <b>CONTRACT</b> with fields
- CONTRACT_ID
- CUSTOMER_ID
- CONTRACTDATE
The IDs of both tables (<b>CUSTOMER</b>, <b>CONTRACT</b>) are generated by the DB.
So the INSERT for the CUSTOMER Table would be
<i>INSERT INTO CUSTOMER (NAME) VALUES ('CLONEY')</i>
For the second insert into the CONTRACT table, I need the CUSTOMER_ID from the first insert. How can I do that in XI?
Thanks a lot, Regards Mario
You can use stored procedures to do it?Isnot it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi mario,
sorry for asking for something that you have already given
One solution to your problem, Design a SYNCHRONOUS JDBC RECEIVER, that will return the CUSTOMER_ID after the insertion for the first table is successsful.
Use the response to map it into the Customer_ID of the 2nd insertion.
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mario,
We faced a smiliar situation and found that using <b>STORED</b> <b>PROCEDURE</b> for your execution was the best way to go. You can call your Stored Procedure from your JDBC adapter and then, your stored procedure can use SEQUENCE in your Stored Procedure to create the unique values that you want.
The data format for insertion using a STORED PROCEUDRE is of the following format,
<root>
<StatementName>
<storedProcedureName action= EXECUTE>
<table>realStoredProcedureeName</table>
<param1 [isInput=true] [isOutput=true] type=SQLDatatype>val1</param1>
</storedProcedureName >
</StatementName5>
</root>
For more info on this, check this link,
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Do get back for any queries,
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhavesh,
thanks for your answer. With the SEQUENCE statement the stored procedure would for example increment the key for a inserted record. But in fact, there are already keys existing. In my special case the DB is managing the keys, so I can't give the key externally. That's why SEQUENCE is unfortunately not the solution.
Thanks Mario
Hi Mario,
How would you do a normal insertion into this table from your Database client. DO you have to give the value for the KEY field in the SQL insertion statement?? Can you give us the insert statement that works for the Database table.
If you do not give any value for the key field while doing the insertion into the Databse, then the same way, you can ignore that field while creating the JDBC receiver.
Regards,
Bhavesh
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.