sql – Informix:选择null问题
发布时间:2020-12-25 03:10:10 所属栏目:MsSql教程 来源:网络整理
导读:使用Informix,我创建了一个临时表,我试图从select语句填充.在此之后,我想进行更新,以填充临时表中的更多字段. 所以我做的事情就像; create temp table _results (group_ser int,item_ser int,restype char(4));insert into _results (group_ser,item_ser)sele
使用Informix,我创建了一个临时表,我试图从select语句填充.在此之后,我想进行更新,以填充临时表中的更多字段. 所以我做的事情就像; create temp table _results (group_ser int,item_ser int,restype char(4)); insert into _results (group_ser,item_ser) select group_ser,item_ser,null from sometable 但是你不能选择null. 例如; select first 1 current from systables 工作,但 select first 1 null from systables 失败! (不要让我开始说明为什么我不能像没有指定表那样只选择“选择当前”这样的SQL Server!) 解决方法This page说你不能这样做的原因是因为“NULL”没有类型.因此,解决方法是创建一个简单地返回所需类型的NULL的sproc.这听起来像是一个非常糟糕的解决方案.也许您可以在脚本中创建一个变量,将其设置为null,然后选择该变量?像这样的东西: DEFINE dummy INT; LET dummy = NULL; SELECT group_ser,dummy FROM sometable (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |