473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

MERGE over db-links

Hi,

I am trying to merge data from two tables (over two servers, using
dblink). Approx 40,000 records in each. Server1(source) and
Server2(dest)

On Server1, db-link "dblink1" points to Server2
On Server2, db-link "dblink1" points to Server1

Schema names are same on the two servers.
<<PULL Data>>

Now, when i am on destination server (Server2), then

MERGE INTO myemp D
USING (SELECT * FROM myemp@dblink1) S
ON (D.emp_id = S.emp_id)
WHEN MATCHED THEN
UPDATE SET
FIRST_NAME = S.FIRST_NAME,
MIDDLE_NAME = S.MIDDLE_NAME,
LAST_NAME = S.LAST_NAME,
LAST_UPDATION_DATE = sysdate
WHEN NOT MATCHED THEN INSERT (EMP_ID, FIRST_NAME, MIDDLE_NAME,
LAST_NAME, LAST_UPDATION_DATE)
VALUES (S.EMP_ID, S.FIRST_NAME, S.MIDDLE_NAME, S.LAST_NAME, sysdate);
works fine...

but if i am on source server (Server1), then

<<PUSH data>>

MERGE INTO myemp@dblink1 D
USING (SELECT * FROM myemp) S
ON (D.emp_id = S.emp_id)
WHEN MATCHED THEN
UPDATE SET
FIRST_NAME = S.FIRST_NAME,
MIDDLE_NAME = S.MIDDLE_NAME,
LAST_NAME = S.LAST_NAME,
LAST_UPDATION_DATE = sysdate
WHEN NOT MATCHED THEN INSERT (EMP_ID, FIRST_NAME, MIDDLE_NAME,
LAST_NAME, LAST_UPDATION_DATE)
VALUES (S.EMP_ID, S.FIRST_NAME, S.MIDDLE_NAME, S.LAST_NAME, sysdate);
produces following error -
The following error has occurred:

ORA-01008: not all variables bound
ORA-02063: preceding line from EMFG_DBLINK1
Is it that for MERGE to work, data is MERGED into "local" table and we
cannot execute MERGE on a remote table through db-link?

I have to do loads of validation and pre-processing on my server1 and
when all data is updated in myemp, then it is to be copied over to
myemp@dblink1. Replication is not to be used, have to work within the
boundaries assigned. Other waye round, i'll have to create a wrapper
sql script using sql*plus "connect" to connect to server2 and then
calling MERGE (PULLING data) from there instead of PUSHING the updated
data from server1. Is there any other way out?

Please help.!!
Jul 19 '05 #1
0 6096

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mahmoud KHEBAISA | last post by:
Hi, I have two databases on MS. SQL Server 200 the first one is the main DB and the second one is a replica of it, both of them in different territories .I connect them using merge replication just...
1
by: Sebastian Luemmer | last post by:
Hi, I have developed an SQL-Script which I tested successfully on DB2 v8.1.3.132 (SQL08013). When I tried to run the script on a DB2 v8.1.0.36 (SQL08010) the script failed with the message ...
8
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for...
0
by: beerman | last post by:
I have developed an app (in Access 2002) that dynamically creates a table, and the fields in that table, for propagation based on the max number of occurences in a reference table. Basically, it...
9
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access...
2
by: David | last post by:
I am having problems closing winword.exe.My mail merge works ok but the word application is not closing down. Can anyone help in telling me where I am going wrong and what I am missing out of my...
0
by: Sheila | last post by:
I have set up a Word mail merge document of the type Directory which allows me to display all of the records on a single page rather than putting each record on a separate page. It uses a...
8
by: Ron B | last post by:
Help!!! What am I doing wrong? I am working with Office 2003 and am trying to create a command button on an Access form that will create a mail merge in Word from an Access table. I want to...
1
by: b0x | last post by:
I am working on a project where I have 2 files, a .db file, and a .txt file. The DB file contains a 'tag' and a 'value'. The txt file contains a tag, and other info, like location, units, etc so you...
3
by: HarryTheB | last post by:
Hi, I am using the following code in Access 2003 to merge data from a query to a table in a Word document: Private Sub BtnMerge_Click() Dim db As DAO.Database Dim objWord As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.