我想将具有自动递增的uid的行插入到空表中。使用以下代码,由于您无法+1空值(对于PMS_CALC_SCHEDULE_UID),我遇到了错误。我尝试添加INT NOT NULL AUTO_INCREMENT
,但语法无效。
cmdEx.ExecuteNonQuery("INSERT INTO PMS_CALC_SCHEDULE (PMS_CALC_SCHEDULE_UID, USER_UID, SCHEDULED_DATE, PMS_CALC_STATUS_UID, CALCULATION_START_DATE, CALCULATION_END_DATE, STATUS_MESSAGE, PROGRESS) VALUES ((SELECT MAX(PMS_CALC_SCHEDULE_UID) + 1 FROM PMS_CALC_SCHEDULE), '127', '2009-06-15T13:45:30', '0', '2009-06-15T13:45:30','2010-06-15T13:45:30', 'boom', 0 )");
答案 0 :(得分:1)
您可以使用NVL或合并函数,并在col为null时将值分配为0。
Query1 -
with t1 as (select null as col1) select max(col1) + 1 from t1;
o/p
NULL
Query 2 -
with t1 as (select null as col1) select nvl(max(col1),0) + 1 from t1;
o/p
1
答案 1 :(得分:0)
我的问题的解决方案是:
SkipList<int,string>::node* head = static_cast<SkipList<int,string>::node*>(Node);