在VC中通过OCI向oracle数据库插入date类型的数据,
语句为:INSERT INTO SYS.SATCAT(LAUN,DECAY) VALUES(to_date(:num10,'MM/DD/YYYY'),to_date(:num11,'MM/DD/YYYY'));
按照位置绑定的语句为:error_proc(errhp,OCIBindByPos(stmthp,&bnd1p,errhp,1,&num1,sizeof(num1),SQLT_DAT,NULL,NULL,NULL,0, NULL, OCI_DEFAULT));error_proc(errhp,OCIBindByPos(stmthp,&bnd1p,errhp,2,&num2,sizeof(num2),SQLT_DAT,NULL,NULL,NULL,0, NULL, OCI_DEFAULT));
结果出现如下错误:DATE或NUMBER赋值变量的长度无效;请问这是为什么?哪里出错了?(其中,char num1[11],num2[11];两者的值分别为06/25/2006和07/26/2008)。
语句为:INSERT INTO SYS.SATCAT(LAUN,DECAY) VALUES(to_date(:num10,'MM/DD/YYYY'),to_date(:num11,'MM/DD/YYYY'));
按照位置绑定的语句为:error_proc(errhp,OCIBindByPos(stmthp,&bnd1p,errhp,1,&num1,sizeof(num1),SQLT_DAT,NULL,NULL,NULL,0, NULL, OCI_DEFAULT));error_proc(errhp,OCIBindByPos(stmthp,&bnd1p,errhp,2,&num2,sizeof(num2),SQLT_DAT,NULL,NULL,NULL,0, NULL, OCI_DEFAULT));
结果出现如下错误:DATE或NUMBER赋值变量的长度无效;请问这是为什么?哪里出错了?(其中,char num1[11],num2[11];两者的值分别为06/25/2006和07/26/2008)。
http://hi.baidu.com/wangchunxin/blog/item/f893d51b83cffdfbae513332.html
而是需要一个SQLT_STR型进去。祝好运。
OCI之路,开始会有点磕碰,以后就慢慢会好些。
INSERT INTO SYS.SATCAT(LAUN,DECAY)
VALUES(to_date(to_char(:num10),'MM/DD/YYYY'),to_date(to_char(:num11),'MM/DD/YYYY'));