Topic: 【求助】oracle中如何将记录从一个库导入到另一个库中?

  Print this page

1.【求助】oracle中如何将记录从一个库导入到另一个库中? Copy to clipboard
Posted by: FreeSky
Posted on: 2004-08-12 21:37

有两个oracle数据库库,一个开发库,一个测试库,两个库的的表结构相同。
现在,想把测试库中A表中的几条记录,导入开发库中的A表,如何做呀?

TOAD或PL/SQL 中有工具么?

2.Re:【求助】oracle中如何将记录从一个库导入到另一个库中? [Re: FreeSky] Copy to clipboard
Posted by: 九佰
Posted on: 2004-08-13 09:27

使用toad很方便
用toad从一个库中导出sql,然后到另外一个库中执行之

3.Re:【求助】oracle中如何将记录从一个库导入到另一个库中? [Re: FreeSky] Copy to clipboard
Posted by: lhzwill
Posted on: 2004-09-12 00:10

做一个A库的映射到B库,就可以直接用SQL语句了

4.Re:【求助】oracle中如何将记录从一个库导入到另一个库中? [Re: FreeSky] Copy to clipboard
Posted by: redmiddle
Posted on: 2004-09-13 17:47

如果在同一台机器上可以直接就用
selct * into B.xxx from yyyy
B表示另外一个库的用户名
如果不在同一台机器上就必须先映射出这个B出来.然后下同样的SQL.怎么映射的话请查oracle使用手册.我忘记了.不好意思.

5.Re:【求助】oracle中如何将记录从一个库导入到另一个库中? [Re: FreeSky] Copy to clipboard
Posted by: hk109
Posted on: 2004-10-22 09:26

package gov.hebjs.test;

import gov.hebjs.base.conn;
import gov.hebjs.base.linkdb;
import java.sql.ResultSet;
import java.sql.*;
import java.util.Vector;

/**
* <p>Title: 测试两个数据库连接</p>
* <p>Description: </p>
* <p>Copyright: Copyright Coffee 2003</p>
* <p>Company: </p>
* @author 网辉
* @version 1.0
*/

public class testnw {

public testnw() {
}

public conn db = new conn();
public linkdb mdb=new linkdb();
public int addout(String name) {

String sql = "insert into jst(id,name)valuse(seq_jst.nextval,'" + name +
"')";
db.close();
return db.executeUpdate(sql);
}

public void tongbu(String tablename) {
String ziduanname = null;
String insertsql = "";

String myvalue = "";
int tablenum = 0;
try {
String sql = "select * from " + tablename;
ResultSet rstableid = db.executeQuery(sql);
ResultSetMetaData rsmd = rstableid.getMetaData();
tablenum = rsmd.getColumnCount();

for (int i = 1; i <= tablenum; i++) {
ziduanname = rsmd.getColumnLabelLight Bulb;
if (i == 1) {
insertsql += ziduanname + "";
}
else {
insertsql += "," + ziduanname + "";
}

}
insertsql = "insert into " + tablename + " (" + insertsql + ") values(";

while (rstableid.next()) {
String insertsql2 = "";
String insertsql3 = "";
for (int j = 1; j <= tablenum; j++) {
Object myvalues = rstableid.getObject(j);
if (myvalues != null) {
myvalue = myvalues.toString();
}
else {
myvalue = "";
}
int type = rsmd.getColumnType(j);
if (j == 1) {
insertsql2 += myvalue;
}
else {
if (type == 2) {
insertsql2 += "," + myvalue;
}
if (type == 12) {
insertsql2 += ",'" + myvalue + "'";
}
}

}
insertsql3 = insertsql + insertsql2 + ")";
mdb.executeUpdate(insertsql3);

}

}
catch (Exception ex1) {

}

}
}

6.Re:【求助】oracle中如何将记录从一个库导入到另一个库中? [Re: FreeSky] Copy to clipboard
Posted by: jameszhang
Posted on: 2004-10-22 09:33

copy from 命令可以或用数据连接


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923