泡泡小仙 2016-12-30 06:10 采纳率: 0%
浏览 1100

变量不能在insert的时候作为被插入表的字段名

test1表中的ind_字段的值是test2表中的字段名,我想用存储过程实现将test1表中的数据一条一条地插入test2中,有点像列转行,但是原问题比这个复杂的多,**但是好像变量值不能作为insert into test2的字段名**,这个位置提示'virtual column not allowed here' ,但是为甚么变量可以作为select 的字段名呢,怎么解决我这个问题,动态sql没用,11g的pivot指标不治本,那个大神帮我从语法或者写机制这方面看看能不能解决啊

create or replace procedure count_to_    is
cursor recos is select  *  from test1;
resid_  varchar2(32);
indexva_  number;
name_  varchar2(32);
begin
   for reco in recos loop
     resid_:=reco.id_;
     name_ :=reco.ind_;
     indexva_:=reco.val_;
     begin
      insert into test2(id_,name_ )   values (resid_,indexva_);
       end;
       end loop;
       end ;

  • 写回答

1条回答 默认 最新

  • Tiger_Zhao 2016-12-30 07:13
    关注

    这个错误是说虚拟列(virual column)不能作为插入数据的列啊。
    虚拟列是计算出来的,没有存储数据的实际空间。

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器