Sponsored Content
Top Forums Shell Programming and Scripting Moving data from one database to other Post 56671 by mbb on Thursday 7th of October 2004 12:49:46 PM
Old 10-07-2004
If the employee_id/department are a unique reference then, you can do something like this in a script:

EMP_ID=123
DEPT=SALES

dbaccess source_db - << !
unload to source.unl select * from source_table
where employee_id = $EMP_ID
and department = $DEPT;
!

Insert the results to a temporary table with:

dbaccess destination_db - << !
load from source.unl insert into tt_source;
!

Then:

dbaccess destination_db - << !
update dest_table set
dest_table.col1 =
(select tt_source.col1
from tt_source
where tt_source.employee_id = dest_table.employee_id
and tt_source.department = dest_table.department);
where dest_table.employee_id = $EMP_ID
and dest_table.department = $DEPT;
!

Take a backup of your databases before you try this! Use dbexport to do this.

I don't think this will be too fast if you have many updates to perform. Consider doing this with an esql/c application if you have esql/c available.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Moving specific data between databases

Dear All, I have 2 databases, There is a lot of data in both the databases, i would like to move some data from one database to the other. I would like to accept 2 parameters from the user, i.e. emplyee id & dept, on entering the 2 i will unload all the data from the tables to the flat files.... (2 Replies)
Discussion started by: lloydnwo
2 Replies

2. UNIX for Dummies Questions & Answers

Howto capture data from rs232port andpull data into oracle database-9i automatically

Hi, i willbe very much grateful to u if u help me out.. if i simply connect pbx machine to printer by serial port RS232 then we find this view: But i want to capture this data into database automatically when the pbx is running.The table in database will contain similar to this view inthe... (1 Reply)
Discussion started by: boss
1 Replies

3. Infrastructure Monitoring

moving rrd data to mysql

All I currently run an application called OpenNMS. This is a free enterprise grade NMS. Its current framework uses RRDs to collect performance/node level data such as cpu load via snmp. all data is stored in these RRDs. I was wondering if anyone out there has had a chance or a need to move the... (2 Replies)
Discussion started by: pupp
2 Replies

4. Shell Programming and Scripting

Moving a database from one server to another

I hope I'm posting this in the correct section. I'm trying to move a database from one server to another. This is the code I'm using... tar czf - vbdatabase.sql | ssh username@full.domain.com 'cat > /home/cpanelusername/vbdatabase.tar.gz ... but all I'm getting is a ">" and then nothing... (4 Replies)
Discussion started by: Chimpie
4 Replies

5. Shell Programming and Scripting

Moving a column across a delimited data file

Hi, I am trying to move a column from one position to another position in a delimited file. The positions are dynamic in nature and are available by environmental variables. Also the file can have n number of columns. Example: Initial Column Position=1 Final Column Position=3 Delimiter='|' ... (2 Replies)
Discussion started by: ayan153
2 Replies

6. UNIX and Linux Applications

Moving Oracle database

how does one move Oracle database to new OS? Does Oracle need to be the same version as old one? (6 Replies)
Discussion started by: orange47
6 Replies

7. UNIX for Dummies Questions & Answers

Data file moving

Suppose there is a file “Text1.txt” which contains 100 lines. I need to move 1st 25 line into another file “Text2.txt” How we can do it? Suppose there is a file “Text1.txt” in which city: Bangalore is repeating N times. I need to replace Bangalore with Delhi. How we can do... (1 Reply)
Discussion started by: Rajesh1412
1 Replies

8. Shell Programming and Scripting

Pulling Data, Then Moving to the Next File

I'm scanning a list of emails- I need to pull 2 pieces of data, then move to the next file: Sender's Email Address Email Date I need these to be outputted into a single column- separated by a ",". Like this: Email1's Address, Email1's Date Stamp Email2's Address, Email2's Date Stamp... (4 Replies)
Discussion started by: sudo
4 Replies

9. UNIX for Beginners Questions & Answers

Help with moving list of data to 2nd column of HTML file

Hi Team, Can you help me with writing shell script to printing the list output to 2nd column in HTML file. (2 Replies)
Discussion started by: veereshshenoy
2 Replies
XrmMergeDatabases(3)						  XLIB FUNCTIONS					      XrmMergeDatabases(3)

NAME
XrmMergeDatabases, XrmCombineDatabase, XrmCombineFileDatabase - merge resource databases SYNTAX
void XrmMergeDatabases(XrmDatabase source_db, XrmDatabase *target_db); void XrmCombineDatabase(XrmDatabase source_db, XrmDatabase *target_db, Bool override); Status XrmCombineFileDatabase(char *filename, XrmDatabase *target_db, Bool override); ARGUMENTS
source_db Specifies the resource database that is to be merged into the target database. target_db Specifies the resource database into which the source database is to be merged. filename Specifies the resource database file name. override Specifies whether source entries override target ones. DESCRIPTION
Calling the XrmMergeDatabases function is equivalent to calling the XrmCombineDatabase function with an override argument of True. The XrmCombineDatabase function merges the contents of one database into another. If the same specifier is used for an entry in both data- bases, the entry in the source_db will replace the entry in the target_db if override is True; otherwise, the entry in source_db is dis- carded. If target_db contains NULL, XrmCombineDatabase simply stores source_db in it. Otherwise, source_db is destroyed by the merge, but the database pointed to by target_db is not destroyed. The database entries are merged without changing values or types, regardless of the locales of the databases. The locale of the target database is not modified. The XrmCombineFileDatabase function merges the contents of a resource file into a database. If the same specifier is used for an entry in both the file and the database, the entry in the file will replace the entry in the database if override is True; otherwise, the entry in the file is discarded. The file is parsed in the current locale. If the file cannot be read, a zero status is returned; otherwise, a nonzero status is returned. If target_db contains NULL, XrmCombineFileDatabase creates and returns a new database to it. Otherwise, the database pointed to by target_db is not destroyed by the merge. The database entries are merged without changing values or types, regard- less of the locale of the database. The locale of the target database is not modified. SEE ALSO
XrmGetResource(3), XrmInitialize(3), XrmPutResource(3) Xlib - C Language X Interface X Version 11 libX11 1.5.0 XrmMergeDatabases(3)
All times are GMT -4. The time now is 04:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy