cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Query for sender jdbc adapter

former_member189440
Participant
0 Kudos

Hi friends,

i need an sql query as my requirement was i have to retrieve data from 2 tables from one database and insert the same data to another two tables having the same structure in other database here my primary key was ID which was there in both tables.can any one help me on this issue.

Accepted Solutions (1)

Accepted Solutions (1)

dharamveer_gaur2
Active Contributor
0 Kudos

Hi

Use JDBC to JDBC scenario.

JDBC Sender setting:Your Sender Structure would be same as for single table, only your select query would be like Select Emp.EmpName,Emp.SalAcc,Acc.AccountNo From Emp,Acc where Emp.SalAcc =Acc.AccountNo. here Emp and Acc are two table.

JDBC Receiver Sturcture : Use two Statement in your structure. Inside first Statement insert data into first table and other Statement to insert data into second table.

Note: look JDBC receiver structure there is StatementName.

former_member189440
Participant
0 Kudos

Hi,Dharma,

what u have said is correct i have done that one but we need to inserrt the same data to 2 tables in another database . here what i have to write in update sql statement in sender jdbc adapter. i have used the same query waht u posted but i will retrieve the data from the two tables later is has to insert into another two tables in other database.that is my requirement.

Answers (1)

Answers (1)

Former Member
0 Kudos

looks to be like JDBC-JDBC scenario. query the sdn..

former_member189440
Participant
0 Kudos

YES,but what u have posted? i know the scenario is jdbc 2 jdbc in need the sender side sql statements.

Edited by: UDAY on Dec 12, 2008 2:04 AM

VijayKonam
Active Contributor
0 Kudos

use select * from a,b where columnx = 'something'

VJ

Former Member
0 Kudos

Uday,

Just got a bit curious with this business requirement. You can join the table as the person has explained but you need to consider what would be your update query.

You will need to add a column "processed" in either of the table (assume table b) and update this to Y.

So in you select will be

select * from a, b where a.col1 = b.col1 and b.processed = 'Y' (I have specified a join not sure what you require)

Update statement should be

update table b set processed = 'Y'; (Ideally you should have a where clause as above)

regards

Unni

Edited by: Unni Krishnan on Dec 12, 2008 12:52 AM