Oracle序列使用问题!# Database - 数据库
f*y
1 楼
使用VC++编程;
我建立一个序列,希望每次加1,
我在sql plus下执行
select SEQ_MESSAGE_MESSAGE_NUM.nextval from dual;
每次都是对的;
但在程序里面每次却加2,让我不理解;
序列创建:
CREATE SEQUENCE SEQ_MESSAGE_MESSAGE_NUM
INCREMENT BY 1
START WITH 1
MAXVALUE 1.0E28
MINVALUE 1
NOCYCLE
CACHE 20
ORDER;
程序:
ODatabase datab;
ODynaset dyn;
... ...
nOracleRet=dyn.Open(datab,"select
SEQ_MESSAGE_MESSAGE_NUM.nextval from dual");
int nNextVal;
dyn.GetFieldValue(0,&nNextVal);
dyn.Close();
... ...
CString szSql;
szSql.Format("Insert into Transmit_Message
(Message_Nu
我建立一个序列,希望每次加1,
我在sql plus下执行
select SEQ_MESSAGE_MESSAGE_NUM.nextval from dual;
每次都是对的;
但在程序里面每次却加2,让我不理解;
序列创建:
CREATE SEQUENCE SEQ_MESSAGE_MESSAGE_NUM
INCREMENT BY 1
START WITH 1
MAXVALUE 1.0E28
MINVALUE 1
NOCYCLE
CACHE 20
ORDER;
程序:
ODatabase datab;
ODynaset dyn;
... ...
nOracleRet=dyn.Open(datab,"select
SEQ_MESSAGE_MESSAGE_NUM.nextval from dual");
int nNextVal;
dyn.GetFieldValue(0,&nNextVal);
dyn.Close();
... ...
CString szSql;
szSql.Format("Insert into Transmit_Message
(Message_Nu