SQL虚拟列

时间:2010-07-09 04:20:54

标签: sql oracle sql-update

我收到'SQL错误:ORA-01733:虚拟列不允许在这里'

这是我的代码:

update (
   Select g.FIRST300BB from ( 
      select FIRST300BB, row_number() over (order by pitchandeventid) r
      from gamedata_me 
      where hitterid = 5000
      and (eventcode = 'BB')
   ) g
   where r between 0 and 300
) t
set t.FIRST300BB =1

任何想法?我被困了,使用Oracle所以我发现我不能做更新/从语法...所以我已经正式圈出了货车

1 个答案:

答案 0 :(得分:6)

尝试等效查询,例如

update gamedata_me 
  set first300BB=1
where rowid in(
          Select g.rid from ( 
              select rowid rid, row_number() over (order by pitchandeventid) r
                  from gamedata_me 
                 where hitterid = 5000
                 and (eventcode = 'BB')
               ) g
   where r between 0 and 300
    )