当我执行以下插入查询时:
insert into FEED_STAGING_GOOD_TRADE (JOBEXECUTIONID, STAGINGID, ROWNUMBER, system, traderef, mtmvaluation, mtmvaluationccy, prcmtmquality, prcdate)
values (64, NEXTVAL('FEED_STAGING_TRADE_SEQ') ,2,'RMS','TRD3',1.11111111E8,'USD',100.0,'2011-12-09 +00'::timestamp)
我得到以下输出:
ERROR: null value in column "tradestagingid" violates not-null constraint
Detail: Failing row contains (46, 64, null, 2, null, null, null, RMS, null, null, TRD3, null, null, null, null, null, null, null, null, null, null, null, null, 111111111, USD, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 100, 2011-12-09 00:00:00, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null).
应该由NEXTVAL
函数结果填充的第三列被发送为空值,这违反了某个非空值约束。
但是,当我NEXTVAL
像这样独立执行时:
select NEXTVAL('FEED_STAGING_TRADE_SEQ');
该函数返回正确的值,如下图所示: