你的select 语句在sql*plus里面能执行吗?
看一下列数以及类型是否跟要插入的表字段对应。

解决方案 »

  1.   

    把表js_cwhxjjg的数据进行统计,然后插入到表js_cwhhjxj中并能查询js_cwhhjxj的记录的存储过程或是数据库写法是如何的呀   统计查询条件是nd,tcqbm,cbm,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)
       );
    在此先谢各位了!问题不难请各位高动贵手,小弟目前是一介菜鸟,谢谢,只要解决了这个问题,分可以多给一些的,有兴趣还可以介绍一下书给我,谢谢!!!这是我写得一点东西在里面还要加点或修改一点什么东西呀!!!
    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;
    )
      

  2.   

    insert inyo mz_js_cwhhjxj  
    中间写错了.是into.可能你自己没注意吧.
      

  3.   

    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;  
    你的这个语句本身就有问题,有很多字段表里面都没有
    怎么统计?
    你把详细的逻辑写出来。
      

  4.   

    把表js_cwhxjjg的数据进行统计,然后插入到表js_cwhhjxj中并能查询js_cwhhjxj的记录的存储过程或是数据库写法是如何的呀 , js_cwhhjxj表其实就是一个历史表罢了, 统计查询条件是nd,tcqbm,cbm,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了,谢谢各位
      

  5.   

    存储delete一下,insert into 一下,select 一下OK了