- 最后登录
- 2016-4-27
- 在线时间
- 84 小时
- 威望
- 87
- 金钱
- 846
- 注册时间
- 2012-2-22
- 阅读权限
- 50
- 帖子
- 101
- 精华
- 1
- 积分
- 87
- UID
- 253
|
1#
发表于 2012-3-8 11:14:11
|
查看: 6217 |
回复: 6
今天最到一个sql,从本地查出insert 到dblink另一端,select有数据,加上insert变为insert 0条记录
SQL> select count(*) from(
2 select
3 tc.id classId,
4 ts.id semId,
5 tud.shi_org_id shiOrg,
6 tud.xian_org_id xianOrg,
7 tud.dian_org_id dianOrg,
8 tui.icnum,
9 tui.realname,
10 tud.sector,
11 tui.type userType,
12 org.category_id projectType,
13 tost.id examType,
14 tost.name examTypeName,
15 tos.score,
16 tost.formula
17 from TOPBOX_OTHER_SCORE_TYPE tost,
18 topbox_other_score tos,
19 topbox_class tc,
20 topbox_semester ts,
21 topbox_userinfo tui,
22 topbox_userinfodetail tud,
23 topbox_organization org
24 where tost.id = tos.score_type_id
25 and tost.semester_id = ts.id
26 and ts.class_id = tc.id
27 and tos.icnum = tui.icnum
28 and tui.icnum = tud.icnum
29 and org.id = tc.org_id
30 and tc.id = '410010001' ) t;
COUNT(*)
----------
254
SQL> select count(*) from T_TOPBOX_ExamScore_STAT@ln_19129;
COUNT(*)
----------
2
SQL> insert into T_TOPBOX_ExamScore_STAT@ln_19129
2 select SEQ_TOPBOXEXAMSORE.NEXTVAL@ln_19129 ,
3 tc.id classId,
4 ts.id semId,
5 tud.shi_org_id shiOrg,
6 tud.xian_org_id xianOrg,
7 tud.dian_org_id dianOrg,
8 tui.icnum,
9 tui.realname,
10 tud.sector,
11 tui.type userType,
12 org.category_id projectType,
13 tost.id examType,
14 tost.name examTypeName,
15 tos.score,
16 tost.formula
17 from TOPBOX_OTHER_SCORE_TYPE tost,
18 topbox_other_score tos,
19 topbox_class tc,
20 topbox_semester ts,
21 topbox_userinfo tui,
22 topbox_userinfodetail tud,
23 topbox_organization org
24 where tost.id = tos.score_type_id
25 and tost.semester_id = ts.id
26 and ts.class_id = tc.id
27 and tos.icnum = tui.icnum
28 and tui.icnum = tud.icnum
29 and org.id = tc.org_id
30 and tc.id = '410010001' ;
0 rows created.
附两执行计划,上select 下insert
[ 本帖最后由 anbob 于 2012-3-8 16:17 编辑 ] |
|