求助 你的select 语句在sql*plus里面能执行吗?看一下列数以及类型是否跟要插入的表字段对应。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把表js_cwhxjjg的数据进行统计,然后插入到表js_cwhhjxj中并能查询js_cwhhjxj的记录的存储过程或是数据库写法是如何的呀 统计查询条件是nd,tcqbm,cbm,xzbmcreate table js_cwhxjjg ( /*村委会选举结果*/ nd char(4) not null, --年度 cbm varchar2(10) not null, --村编码 tcqbm varchar2(10) null, --县区编码 xzbm varchar2(10) null, --乡镇编码 xmzs number(8) not null, --选民总数(个) bjdjxms number(8) null, --本届登记选民数(个) sfxztxxjwyhc char(1) null, --是否村民小组推选村民选举委员会村(1是,0否) constraint pk_cwhxjjg primary key(nd,cbm));create table js_cwhhjxj ( /*村委会换届选举情况*/ nd char(4) not null, --年度 cbm varchar2(10) not null, --村编码 tcqbm varchar2(10) null, --县区编码 xzbm varchar2(10) null, --乡镇编码 xmzs number(8) not null, --选民总数(个) bjdjxms number(8) null, --本届登记选民数(个) xztxxjwyhcs number(8) null, --村民小组推选村民选举委员会村数(个) constraint pk_cwhhjxj primary key(nd,cbm) );在此先谢各位了!问题不难请各位高动贵手,小弟目前是一介菜鸟,谢谢,只要解决了这个问题,分可以多给一些的,有兴趣还可以介绍一下书给我,谢谢!!!这是我写得一点东西在里面还要加点或修改一点什么东西呀!!!create or table package js_cwh body js_jz is procedrue jack( as_nd in; as_cbm in; as_tcqbm in; as_xzbm in; cur1 out refursor;)isbegininsert into js_cwhhjxj select nd,cbm,tcqbm,xzbm, sum(xmzs),sum(decode(sfxztxxjwyhc,'1',1,0));from js_cwhxjjg;open cur1 for select nd,cbm,tcqbm,xzbm from js_cwhhjxj ; where nd=as_nd,cbm=as_cbm,tcbm=as_tcqbm,xzbm=as_xzbm;end ;end js_jz;) insert inyo mz_js_cwhhjxj 中间写错了.是into.可能你自己没注意吧. select nd,cbm,tcqbm,xzbm,sum(xmzs) xmzs,sum(bjdjxms),sum(nxms) nxms,sum(zjxms) zjxms, sum(ldpxxms) ldpxxms, sum(wttpxms) wttpxms,sum(htxms) htxms, sum(decode(sftxxjwyh,'1',1,0)),sum(decode(sfxztxxjwyhc,'1',1,0)), sum(decode(sfcmztcbhxrc,'1',1,0)),sum(decode(sfqcyxdzshxrc,'1',1,0)),sum(decode(sfcdbydzshxrc,'1',1,0)), sum(decode(sfsmmhpjc,'1',1,0)),sum(decode(sfdcgbxjjgc,'1',1,0)),sum(decode(sfhcxjc,'1',1,0)), sum(decode(sfycxcgc,'1',1,0)),sum(cwhzrrs) cwhzrrs,sum(ncwhzrrs) ncwhzrrs,sum(cwhzr_zgdyrs) cwhzr_zgdyrs, sum(cwhzr_jdzbsjrs) cwhzr_jdzbsjrs,sum(cwhzr_lrrs) cwhzr_lrrs,sum(cwhfzrjwyrs) cwhfzrjwyrs,sum(ncwhfzrjwyrs) ncwhfzrjwyrs, sum(cwhfzrjwydyrs) cwhfzrjwydyrs,sum(cmdbrs) cmdbrs,sum(ncmdbrs) ncmdbrs,sum(cmdbzgdyrs) cmdbzgdyrs, sum(cmxzzrs) cmxzzrs,sum(ncmxzzrs) ncmxzzrs,sum(cmxzzzgdyrs) cmxzzzgdyrs,sum(decode(sfbmsjcwhzrc,'1',1,0)), sum(decode(sfbmsjcfzrjwyc,'1',1,0)),'' from mz_js_cwhxjjg group by nd,cbm,tcqbm,xzbm; 你的这个语句本身就有问题,有很多字段表里面都没有怎么统计?你把详细的逻辑写出来。 把表js_cwhxjjg的数据进行统计,然后插入到表js_cwhhjxj中并能查询js_cwhhjxj的记录的存储过程或是数据库写法是如何的呀 , js_cwhhjxj表其实就是一个历史表罢了, 统计查询条件是nd,tcqbm,cbm,xzbmcreate table js_cwhxjjg ( /*村委会选举结果*/ nd char(4) not null, --年度 cbm varchar2(10) not null, --村编码 tcqbm varchar2(10) null, --县区编码 xzbm varchar2(10) null, --乡镇编码 xmzs number(8) not null, --选民总数(个) bjdjxms number(8) null, --本届登记选民数(个) sfxztxxjwyhc char(1) null, --是否村民小组推选村民选举委员会村(1是,0否) constraint pk_cwhxjjg primary key(nd,cbm));create table js_cwhhjxj ( /*村委会换届选举情况*/ nd char(4) not null, --年度 cbm varchar2(10) not null, --村编码 tcqbm varchar2(10) null, --县区编码 xzbm varchar2(10) null, --乡镇编码 xmzs number(8) not null, --选民总数(个) bjdjxms number(8) null, --本届登记选民数(个) xztxxjwyhcs number(8) null, --村民小组推选村民选举委员会村数(个) constraint pk_cwhhjxj primary key(nd,cbm) );各位就根据我上面的这两张很简单的表写个存储过程并能实行功能就OK了,谢谢各位 存储delete一下,insert into 一下,select 一下OK了 oracle 接口表求助 求SQL语句。。。 oracle 两表取值 oracle中建立唯一约束与唯一索引的区别 高级复制问题:在往复制组中添加主站点时,提示:ora-23375:特性与数据库.....不兼容,如何解决??? 超高难度的sql查询语句,能行你就来(老难了,要有心里准备) 求解 为何编译存储过程会发生锁定? 在oracle database 中创建一个table 数据类型问题 求救!ORACLE导入问题! 存储过程里动态生成试图 ROWNUM怎么只能取得第一行记录
create table js_cwhxjjg ( /*村委会选举结果*/
nd char(4) not null, --年度
cbm varchar2(10) not null, --村编码
tcqbm varchar2(10) null, --县区编码
xzbm varchar2(10) null, --乡镇编码
xmzs number(8) not null, --选民总数(个)
bjdjxms number(8) null, --本届登记选民数(个)
sfxztxxjwyhc char(1) null, --是否村民小组推选村民选举委员会村(1是,0否)
constraint pk_cwhxjjg primary key(nd,cbm)
);create table js_cwhhjxj ( /*村委会换届选举情况*/
nd char(4) not null, --年度
cbm varchar2(10) not null, --村编码
tcqbm varchar2(10) null, --县区编码
xzbm varchar2(10) null, --乡镇编码
xmzs number(8) not null, --选民总数(个)
bjdjxms number(8) null, --本届登记选民数(个)
xztxxjwyhcs number(8) null, --村民小组推选村民选举委员会村数(个)
constraint pk_cwhhjxj primary key(nd,cbm)
);
在此先谢各位了!问题不难请各位高动贵手,小弟目前是一介菜鸟,谢谢,只要解决了这个问题,分可以多给一些的,有兴趣还可以介绍一下书给我,谢谢!!!这是我写得一点东西在里面还要加点或修改一点什么东西呀!!!
create or table package js_cwh body js_jz is
procedrue jack
(
as_nd in;
as_cbm in;
as_tcqbm in;
as_xzbm in;
cur1 out refursor;
)
is
begin
insert into js_cwhhjxj select nd,cbm,tcqbm,xzbm, sum(xmzs),sum(decode(sfxztxxjwyhc,'1',1,0));
from js_cwhxjjg;
open cur1 for select nd,cbm,tcqbm,xzbm from js_cwhhjxj ;
where nd=as_nd,cbm=as_cbm,tcbm=as_tcqbm,xzbm=as_xzbm;
end ;
end js_jz;
)
中间写错了.是into.可能你自己没注意吧.
sum(wttpxms) wttpxms,sum(htxms) htxms, sum(decode(sftxxjwyh,'1',1,0)),sum(decode(sfxztxxjwyhc,'1',1,0)),
sum(decode(sfcmztcbhxrc,'1',1,0)),sum(decode(sfqcyxdzshxrc,'1',1,0)),sum(decode(sfcdbydzshxrc,'1',1,0)),
sum(decode(sfsmmhpjc,'1',1,0)),sum(decode(sfdcgbxjjgc,'1',1,0)),sum(decode(sfhcxjc,'1',1,0)),
sum(decode(sfycxcgc,'1',1,0)),sum(cwhzrrs) cwhzrrs,sum(ncwhzrrs) ncwhzrrs,sum(cwhzr_zgdyrs) cwhzr_zgdyrs,
sum(cwhzr_jdzbsjrs) cwhzr_jdzbsjrs,sum(cwhzr_lrrs) cwhzr_lrrs,sum(cwhfzrjwyrs) cwhfzrjwyrs,sum(ncwhfzrjwyrs) ncwhfzrjwyrs,
sum(cwhfzrjwydyrs) cwhfzrjwydyrs,sum(cmdbrs) cmdbrs,sum(ncmdbrs) ncmdbrs,sum(cmdbzgdyrs) cmdbzgdyrs,
sum(cmxzzrs) cmxzzrs,sum(ncmxzzrs) ncmxzzrs,sum(cmxzzzgdyrs) cmxzzzgdyrs,sum(decode(sfbmsjcwhzrc,'1',1,0)),
sum(decode(sfbmsjcfzrjwyc,'1',1,0)),'' from mz_js_cwhxjjg group by nd,cbm,tcqbm,xzbm;
你的这个语句本身就有问题,有很多字段表里面都没有
怎么统计?
你把详细的逻辑写出来。
create table js_cwhxjjg ( /*村委会选举结果*/
nd char(4) not null, --年度
cbm varchar2(10) not null, --村编码
tcqbm varchar2(10) null, --县区编码
xzbm varchar2(10) null, --乡镇编码
xmzs number(8) not null, --选民总数(个)
bjdjxms number(8) null, --本届登记选民数(个)
sfxztxxjwyhc char(1) null, --是否村民小组推选村民选举委员会村(1是,0否)
constraint pk_cwhxjjg primary key(nd,cbm)
);create table js_cwhhjxj ( /*村委会换届选举情况*/
nd char(4) not null, --年度
cbm varchar2(10) not null, --村编码
tcqbm varchar2(10) null, --县区编码
xzbm varchar2(10) null, --乡镇编码
xmzs number(8) not null, --选民总数(个)
bjdjxms number(8) null, --本届登记选民数(个)
xztxxjwyhcs number(8) null, --村民小组推选村民选举委员会村数(个)
constraint pk_cwhhjxj primary key(nd,cbm)
);
各位就根据我上面的这两张很简单的表写个存储过程并能实行功能就OK了,谢谢各位