|
oracle表(worker)定义为:
workid number 10
workname varchar2 10
存储过程(pwork)定义为
(
pworkid in worker.workid%type,
pworkname in worker.workname%type
)
as
begin
insert into worker(workid,workname) values(pworkid,pworkname);
end;
我写了一个程序如下:
int main()
{
DBHANDLE *pDBHandle;
SQLUINTEGER PartID;
SQLCHAR PartName[10];
SQLINTEGER PartIDInd=0, PartNameInd=0;
SQLRETURN ret=0;
连接数据库等程序(略)
if(SQL_SUCCESS != SQLBindParameter(pDBHandle->hSTMT, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &PartID, 0, &PartIDInd))
printf("Error: SQLBindParameter.\n");
if(SQL_SUCCESS != SQLBindParameter(pDBHandle->hSTMT, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 10, 0, PartName, 0, &PartNameInd))
printf("Error: SQLBindParameter.\n");
PartID=1024;
strcpy(PartName, "ABC");
if(mDBSuccess != SQLExecDirect(pDBHandle->hSTMT, "{call pwork(?,?)}", SQL_NTS))
{
printf("ERROR.\n");
return -1;
}
return 0;
}
现在的问题是:
查询后如下:
10:55:25 10:55:25
WORKID WORKNAME
---------- ----------
1024
已选择 1 行。
即WORKNAME的数据"ABC"为什么没有存到数据库里面,我查了好久,不知道?希望知道的能指点一下! |
|