您的位置:程序门 -> db2 -> 数据库开发



db2中以下insert,update语句失败是什么原因?请高手指教!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


db2中以下insert,update语句失败是什么原因?请高手指教!
发表于:2008-02-26 22:09:12 楼主
db2   => update   v_contentvisual_hk   set   spid   =   '350000000001'
db21034e     the   command   was   processed   as   an   sql   statement   because   it   was   not   a
valid   command   line   processor   command.     during   sql   processing   it   returned:
sql0150n     the   target   fullselect,   view,   typed   table,   materialized   query   table,
or   staging   table   in   the   insert,   delete,   update,   or   merge   statement   is   a   target
for   which   the   requested   operation   is   not   permitted.     sqlstate=42807
一般来说:insert,update失败的原因是主键冲突,外键冲突,以下失败的原因是什么?

db2   =>   insert   into   v_contentvisual_hk           (cid,name,description,rejectcause,searchstr,spid,type,servicetype,curstatus,fi
leurl,displayurl,laststatusmodifydate,createdate,lastmodifydate,lastmodifier,creator,instanceid,areaid,updateflg,relatio
ncid,apptype,tostatus,onlineflag,onlinetime,offlinetime,adminrightcode,sprightcode,channelname)   values('bs61','','','',c
lob(''),'350000000001',1,35,'','','','','20080219193902','20080220193905','350000000001','',0,'','','',0,'','','','','',
'','zb1')
db21034e     the   command   was   processed   as   an   sql   statement   because   it   was   not   a
valid   command   line   processor   command.     during   sql   processing   it   returned:
sql0151n     the   column   "channelname"   cannot   be   updated.     sqlstate=42808
发表于:2008-02-26 22:37:551楼 得分:0
在db2中,可以更新视图的记录,也可以向视图中插入记录。众所周知,视图中没有数据,那么无论更新还是插入,其实都是操作基表。如果一个视图只来源于一个基表(没有使用group   by等汇总语句),那么以上操作应该没有任何问题,但是如果你的视图是只读试图(视图来源于一个join的结果、一个group   by的结果等等),那么你的操作当然失败了,也就是说,当db2无法判断你插入的/更新的数据是来源于那一个基表的时候,就抱错。
发表于:2008-02-27 09:23:222楼 得分:0
v_contentvisual_hk   是视图?



快速检索

最新资讯
热门点击