免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 2814 | 回复: 10
打印 上一主题 下一主题

急!!OCI批更新没有得到想要的结果!请大仙们帮帮忙!!! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-09-19 17:01 |只看该作者 |倒序浏览
急!!
OCI批更新没有得到想要的结果!请大仙们帮帮忙!!!

先谢过了!!

[ 本帖最后由 windtouch 于 2006-9-20 10:40 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-09-20 09:45 |只看该作者
这里贴上oci/samples下的cdemodr1.c例程,我对demo_update稍微做了下修改,其他都不变,如有表情符号,请参考cdemodr1.c源程序

static sword demo_update(OCISvcCtx *svchp, OCIStmt *stmthp,
                          OCIBind *bndhp[], OCIError *errhp)
{
  int   i, j;
  int   range_size = 3;                                       /* iterations */


  /*
   * This function updates columns in table TAB1, for certain rows
   * depending on the values of the :low and :high values in
   * in the WHERE clause. It executes this statement 3 times, (3 iterations)
   * each time with a different set of values for :low and :high
   * Thus for each iteration, multiple rows are returned depending
   * on the number of rows that matched the WHERE clause.
   *
   * The rows it updates here are the rows that were inserted by the
   * cdemodr1.sql script.
   */

  /* The Update Statement with RETURNING clause */
  text *sqlstmt = (text *)
                   "UPDATE TAB1 SET  C2 = :2, C3 = :3, \
                           C4 = :4, C5 = :5, C6 = :6, \
                           C7 = :7, C8 = :8, C9 = :9, C10 = :10 \
                           RETURNING  C2, C3, C4, C5, C6, C7, C8, C9, C10 \
                                                   INTO :out2, :out3, :out4, :out5, :out6, \
                                                   :out7, :out8, :out9,:out10";

  /* Prepare the statement */
  if (OCIStmtPrepare(stmthp, errhp, sqlstmt, (ub4)strlen((char *)sqlstmt),
                    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT))
  {
    (void) printf("FAILED: OCIStmtPrepare() update\n");
    report_error(errhp);
    return OCI_ERROR;
  }

  /* Initialise the buffers for insertion */
  for (i = 0; i < MAXITER; i++)
  {
    //in1 = 300 + i;
    memset((void *)in2, (int) 'a'+i%26, (size_t) 40);
    memset((void *)in3, (int) 'A'+i%26, (size_t) 40);
    in4 = 1401.555 + (float)i;
    in5 = 500 + i;
    in6 = 600.280 + (float)i;
    in7 = 700 + i;
    in8 = 800.620 + (float)i;
    in9[0] = 119;
    in9[1] = 185 - (ub1)i%10;
    in9[2] = (ub1)i%12 + 1;
    in9[3] = (ub1)i%25 + 1;
    in9[4] = 0;
    in9[5] = 0;
    in9[6] = 0;
    for (j = 0; j < 40; j++)
      in10[j] = (ub1) (i%0x08);

    rowsret =0;
  }

  /* Bind all the input buffers to place holders (:1, :2. :3, etc ) */
  //if (bind_input(stmthp, bndhp, errhp))
  //  return OCI_ERROR;
    if (/*OCIBindByPos(stmthp, &bndhp[0], errhp, (ub4) 1,
                      (dvoid *) &in1[0], (sb4) sizeof(in1[0]), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || */OCIBindByPos(stmthp, &bndhp[1], errhp, (ub4) 1,
                      (dvoid *) in2[0], (sb4) sizeof(in2[0]), SQLT_AFC,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[2], errhp, (ub4) 2,
                      (dvoid *) in3[0], (sb4) sizeof(in3[0]), SQLT_CHR,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[3], errhp, (ub4) 3,
                      (dvoid *) &in4[0], (sb4) sizeof(in4[0]), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[4], errhp, (ub4) 4,
                      (dvoid *) &in5[0], (sb4) sizeof(in5[0]), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[5], errhp, (ub4) 5,
                      (dvoid *) &in6[0], (sb4) sizeof(in6[0]), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[6], errhp, (ub4) 6,
                      (dvoid *) &in7[0], (sb4) sizeof(in7[0]), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[7], errhp, (ub4) 7,
                      (dvoid *) &in8[0], (sb4) sizeof(in8[0]), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[8], errhp, (ub4) 8,
                      (dvoid *) in9[0], (sb4) sizeof(in9[0]), SQLT_DAT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[9], errhp, (ub4) 9,
                      (dvoid *) in10[0], (sb4) sizeof(in10[0]), SQLT_BIN,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT))
  {
    (void) printf("FAILED: OCIBindByPos()\n");
    report_error(errhp);
    return OCI_ERROR;
  }

   if (/*OCIBindArrayOfStruct(bndhp[0], errhp, s1, indsk[0], rlsk[0], rcsk[0])
   ||*/ OCIBindArrayOfStruct(bndhp[1], errhp, s2, indsk[1], rlsk[1], rcsk[1])
   || OCIBindArrayOfStruct(bndhp[2], errhp, s3, indsk[2], rlsk[2], rcsk[2])
   || OCIBindArrayOfStruct(bndhp[3], errhp, s4, indsk[3], rlsk[3], rcsk[3])
   || OCIBindArrayOfStruct(bndhp[4], errhp, s5, indsk[4], rlsk[4], rcsk[4])
   || OCIBindArrayOfStruct(bndhp[5], errhp, s6, indsk[5], rlsk[5], rcsk[5])
   || OCIBindArrayOfStruct(bndhp[6], errhp, s7, indsk[6], rlsk[6], rcsk[6])
   || OCIBindArrayOfStruct(bndhp[7], errhp, s8, indsk[7], rlsk[7], rcsk[7])
   || OCIBindArrayOfStruct(bndhp[8], errhp, s9, indsk[8], rlsk[8], rcsk[8])
   || OCIBindArrayOfStruct(bndhp[9], errhp, s10, indsk[9], rlsk[9], rcsk[9]))
  {
    (void) printf("FAILED: OCIBindArrayOfStruct()\n");
    report_error(errhp);
    return OCI_ERROR;
  }
  /* Bind all the output buffers to place holders (:out1, :out2 etc */
  //if (bind_output(stmthp, bndhp, errhp))
  //  return OCI_ERROR;

   if (/*OCIBindByName(stmthp, &bndhp[10], errhp,
                      (text *) ":out1", (sb4) strlen((char *) ":out1"),
                      (dvoid *) 0, (sb4) sizeof(int), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   ||*/ OCIBindByName(stmthp, &bndhp[11], errhp,
                      (text *) ":out2", (sb4) strlen((char *) ":out2"),
                      (dvoid *) 0, (sb4) MAXCOLLEN, SQLT_AFC,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   || OCIBindByName(stmthp, &bndhp[12], errhp,
                      (text *) ":out3", (sb4) strlen((char *) ":out3"),
                      (dvoid *) 0, (sb4) MAXCOLLEN, SQLT_CHR,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   || OCIBindByName(stmthp, &bndhp[13], errhp,
                      (text *) ":out4", (sb4) strlen((char *) ":out4"),
                      (dvoid *) 0, (sb4) sizeof(float), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   || OCIBindByName(stmthp, &bndhp[14], errhp,
                      (text *) ":out5", (sb4) strlen((char *) ":out5"),
                      (dvoid *) 0, (sb4) sizeof(int), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   || OCIBindByName(stmthp, &bndhp[15], errhp,
                      (text *) ":out6", (sb4) strlen((char *) ":out6"),
                      (dvoid *) 0, (sb4) sizeof(float), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   || OCIBindByName(stmthp, &bndhp[16], errhp,
                      (text *) ":out7", (sb4) strlen((char *) ":out7"),
                      (dvoid *) 0, (sb4) sizeof(int), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   || OCIBindByName(stmthp, &bndhp[17], errhp,
                      (text *) ":out8", (sb4) strlen((char *) ":out8"),
                      (dvoid *) 0, (sb4) sizeof(float), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   || OCIBindByName(stmthp, &bndhp[18], errhp,
                      (text *) ":out9", (sb4) strlen((char *) ":out9"),
                      (dvoid *) 0, (sb4) DATBUFLEN, SQLT_DAT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC)
   || OCIBindByName(stmthp, &bndhp[19], errhp,
                      (text *) ":out10", (sb4) strlen((char *) ":out10"),
                      (dvoid *) 0, (sb4) MAXCOLLEN, SQLT_BIN,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DATA_AT_EXEC))
  {
    (void) printf("FAILED: OCIBindByName()\n");
    report_error(errhp);
    return OCI_ERROR;
  }


  for (i = 0; i < MAXCOLS; i++)
    pos = i;

  if (/*OCIBindDynamic(bndhp[10], errhp, (dvoid *) &pos[0], cbf_no_data,
                    (dvoid *) &pos[0], cbf_get_data)
  ||*/  OCIBindDynamic(bndhp[11], errhp, (dvoid *) &pos[1], cbf_no_data,
                    (dvoid *) &pos[1], cbf_get_data)
  ||  OCIBindDynamic(bndhp[12], errhp, (dvoid *) &pos[2], cbf_no_data,
                    (dvoid *) &pos[2], cbf_get_data)
  ||  OCIBindDynamic(bndhp[13], errhp, (dvoid *) &pos[3], cbf_no_data,
                    (dvoid *) &pos[3], cbf_get_data)
  ||  OCIBindDynamic(bndhp[14], errhp, (dvoid *) &pos[4], cbf_no_data,
                    (dvoid *) &pos[4], cbf_get_data)
  ||  OCIBindDynamic(bndhp[15], errhp, (dvoid *) &pos[5], cbf_no_data,
                    (dvoid *) &pos[5], cbf_get_data)
  ||  OCIBindDynamic(bndhp[16], errhp, (dvoid *) &pos[6], cbf_no_data,
                    (dvoid *) &pos[6], cbf_get_data)
  ||  OCIBindDynamic(bndhp[17], errhp, (dvoid *) &pos[7], cbf_no_data,
                    (dvoid *) &pos[7], cbf_get_data)
  ||  OCIBindDynamic(bndhp[18], errhp, (dvoid *) &pos[8], cbf_no_data,
                    (dvoid *) &pos[8], cbf_get_data)
  ||  OCIBindDynamic(bndhp[19], errhp, (dvoid *) &pos[9], cbf_no_data,
                    (dvoid *) &pos[9], cbf_get_data))
  {
    (void) printf("FAILED: OCIBindDynamic()\n");
    report_error(errhp);
    return OCI_ERROR;
  }
  /* bind row indicator low, high */
  //if (bind_low_high(stmthp, bndhp, errhp))
  //  return OCI_ERROR;

  /* update rows
         between 101 and 103;  --  expecting 3 rows returned (update 3 rows)
         between 105 and 106;  --  expecting 2 rows returned (update 2 rows)
         between 109 and 113;  --  expecting 5 rows returned (update 5 rows)
  */
  lowc1[0] = 101;
  highc1[0] = 103;

  lowc1[1] = 105;
  highc1[1] = 106;

  lowc1[2] = 109;
  highc1[2] = 113;

  (void) printf("\n\n DEMONSTRATING UPDATE....RETURNING \n");
  if (OCIStmtExecute(svchp, stmthp, errhp, (ub4) range_size, (ub4) 0,
                    (CONST OCISnapshot*) 0, (OCISnapshot*) 0,
                    (ub4) OCI_DEFAULT))
  {
    (void) printf("FAILED: OCIStmtExecute() update\n");
    report_error(errhp);
    return OCI_ERROR;
  }

  /* Commit the changes */
  (void) OCITransCommit(svchp, errhp, (ub4) 0);

  /* Print out the values in the return rows */
  //(void) print_return_data(range_size);

  return OCI_SUCCESS;
}

[ 本帖最后由 rollingpig 于 2006-9-20 10:47 编辑 ]

论坛徽章:
0
3 [报告]
发表于 2006-09-20 09:51 |只看该作者
表创建脚本如下:
   create table TAB1
   (
    c1 integer not null
    c2 char(40),
    c3 varchar2(40),
    c4 float,
    c5 decimal,
    c6 decimal(8,3),
    c7 numeric,
    c8 numeric(7,2),
    c9 date,
    c10 raw(40),
    constraint ind_tab1
   )
   organization index;

论坛徽章:
0
4 [报告]
发表于 2006-09-20 09:56 |只看该作者
在demo_insert后得到的结果是:
  C1         C4
---- ----------
   1 400.554993
   2 401.554993
   3 402.554993
   4 403.554993
   5 404.554993
   6 405.554993
   7 406.554993
   8 407.554993
   9 408.554993
  10 409.554993
期望通过demo_update将上面的C4批修改为+1001
但是得到的结果却是:
  C1         C4
---- ----------
   1 1403.55505
   2 1403.55505
   3 1403.55505
   4 1403.55505
   5 1403.55505
   6 1403.55505
   7 1403.55505
   8 1403.55505
   9 1403.55505
  10 1403.55505
请各位大仙们帮我看看是什么原因
先谢了

论坛徽章:
0
5 [报告]
发表于 2006-09-20 10:35 |只看该作者
在线等待帮助!!!
急!!!!

论坛徽章:
0
6 [报告]
发表于 2006-09-20 10:52 |只看该作者
SQL 怎么能是这个样子呢?
UPDATE TAB1 SET  C2 = :2, C3 = :3,
                           C4 = :4, C5 = :5, C6 = :6, \
                           C7 = :7, C8 = :8, C9 = :9, C10 = :10

应该是
UPDATE TAB1 SET  C2 = :2, C3 = :3,
                           C4 = :4, C5 = :5, C6 = :6,
                           C7 = :7, C8 = :8, C9 = :9, C10 = :10
Where C1 = :1

论坛徽章:
0
7 [报告]
发表于 2006-09-20 11:31 |只看该作者
原帖由 rollingpig 于 2006-9-20 10:52 发表
SQL 怎么能是这个样子呢?
UPDATE TAB1 SET  C2 = :2, C3 = :3,
                           C4 = :4, C5 = :5, C6 = :6, \
                           C7 = :7, C8 = :8, C9 = :9, C10 = :10

应该是
U ...


太感谢你了!!!!!!
我马上试试

论坛徽章:
0
8 [报告]
发表于 2006-09-20 11:52 |只看该作者
原帖由 rollingpig 于 2006-9-20 10:52 发表
SQL 怎么能是这个样子呢?
UPDATE TAB1 SET  C2 = :2, C3 = :3,
                           C4 = :4, C5 = :5, C6 = :6, \
                           C7 = :7, C8 = :8, C9 = :9, C10 = :10

应该是
U ...


大哥,我调了下,结果还是一样的

请你帮我调调吧!!!!

谢谢!!!!

论坛徽章:
0
9 [报告]
发表于 2006-09-20 11:56 |只看该作者
原帖由 windtouch 于 2006-9-20 11:52 发表


大哥,我调了下,结果还是一样的

请你帮我调调吧!!!!

谢谢!!!!


这是我刚刚改调过的程序,你帮我看看哪里需要改

static sword demo_update(OCISvcCtx *svchp, OCIStmt *stmthp,
                          OCIBind *bndhp[], OCIError *errhp)
{
  int   i, j;
  int   range_size = 3;                                       /* iterations */


  /* The Update Statement with RETURNING clause */

  text *sqlstmt = (text *)
                   "UPDATE TAB1 SET  C2 = :2, C3 = :3, \
                           C4 = :4, C5 = :5, C6 = :6, \
                           C7 = :7, C8 = :8, C9 = :9, C10 = :10 \
            WHERE C1= :1";

  /* Prepare the statement */
  if (OCIStmtPrepare(stmthp, errhp, sqlstmt, (ub4)strlen((char *)sqlstmt),
                    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT))
  {
    (void) printf("FAILED: OCIStmtPrepare() update\n";
    report_error(errhp);
    return OCI_ERROR;
  }

  /* Initialise the buffers for insertion */
  for (i = 0; i < MAXITER; i++)
  {
    in1 = 300 + i;
    memset((void *)in2, (int) 'a'+i%26, (size_t) 40);
    memset((void *)in3, (int) 'A'+i%26, (size_t) 40);
    in4 = 1401.555 + (float)i;
    in5 = 500 + i;
    in6 = 600.280 + (float)i;
    in7 = 700 + i;
    in8 = 800.620 + (float)i;
    in9[0] = 119;
    in9[1] = 185 - (ub1)i%10;
    in9[2] = (ub1)i%12 + 1;
    in9[3] = (ub1)i%25 + 1;
    in9[4] = 0;
    in9[5] = 0;
    in9[6] = 0;
    for (j = 0; j < 40; j++)
      in10[j] = (ub1) (i%0x0;

    rowsret =0;
  }

  /* Bind all the input buffers to place holders (:1, :2. :3, etc ) */
  //if (bind_input(stmthp, bndhp, errhp))
  //  return OCI_ERROR;
    if (OCIBindByPos(stmthp, &bndhp[0], errhp, (ub4) 10,
                      (dvoid *) &in1[0], (sb4) sizeof(in1[0]), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[1], errhp, (ub4) 1,
                      (dvoid *) in2[0], (sb4) sizeof(in2[0]), SQLT_AFC,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[2], errhp, (ub4) 2,
                      (dvoid *) in3[0], (sb4) sizeof(in3[0]), SQLT_CHR,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[3], errhp, (ub4) 3,
                      (dvoid *) &in4[0], (sb4) sizeof(in4[0]), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[4], errhp, (ub4) 4,
                      (dvoid *) &in5[0], (sb4) sizeof(in5[0]), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[5], errhp, (ub4) 5,
                      (dvoid *) &in6[0], (sb4) sizeof(in6[0]), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[6], errhp, (ub4) 6,
                      (dvoid *) &in7[0], (sb4) sizeof(in7[0]), SQLT_INT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[7], errhp, (ub4) 7,
                      (dvoid *) &in8[0], (sb4) sizeof(in8[0]), SQLT_FLT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[8], errhp, (ub4) 8,
                      (dvoid *) in9[0], (sb4) sizeof(in9[0]), SQLT_DAT,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT)
   || OCIBindByPos(stmthp, &bndhp[9], errhp, (ub4) 9,
                      (dvoid *) in10[0], (sb4) sizeof(in10[0]), SQLT_BIN,
                      (dvoid *) 0, (ub2 *)0, (ub2 *)0,
                      (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT))
  {
    (void) printf("FAILED: OCIBindByPos()\n";
    report_error(errhp);
    return OCI_ERROR;
  }

  if (OCIBindArrayOfStruct(bndhp[0], errhp, s1, indsk[0], rlsk[0], rcsk[0])
   || OCIBindArrayOfStruct(bndhp[1], errhp, s2, indsk[1], rlsk[1], rcsk[1])
   || OCIBindArrayOfStruct(bndhp[2], errhp, s3, indsk[2], rlsk[2], rcsk[2])
   || OCIBindArrayOfStruct(bndhp[3], errhp, s4, indsk[3], rlsk[3], rcsk[3])
   || OCIBindArrayOfStruct(bndhp[4], errhp, s5, indsk[4], rlsk[4], rcsk[4])
   || OCIBindArrayOfStruct(bndhp[5], errhp, s6, indsk[5], rlsk[5], rcsk[5])
   || OCIBindArrayOfStruct(bndhp[6], errhp, s7, indsk[6], rlsk[6], rcsk[6])
   || OCIBindArrayOfStruct(bndhp[7], errhp, s8, indsk[7], rlsk[7], rcsk[7])
   || OCIBindArrayOfStruct(bndhp[8], errhp, s9, indsk[8], rlsk[8], rcsk[8])
   || OCIBindArrayOfStruct(bndhp[9], errhp, s10, indsk[9], rlsk[9], rcsk[9]))
  {
    (void) printf("FAILED: OCIBindArrayOfStruct()\n";
    report_error(errhp);
    return OCI_ERROR;
  }


  (void) printf("\n\n DEMONSTRATING UPDATE....RETURNING \n";
  if (OCIStmtExecute(svchp, stmthp, errhp, (ub4) range_size, (ub4) 0,
                    (CONST OCISnapshot*) 0, (OCISnapshot*) 0,
                    (ub4) OCI_DEFAULT))
  {
    (void) printf("FAILED: OCIStmtExecute() update\n";
    report_error(errhp);
    return OCI_ERROR;
  }

  /* Commit the changes */
  (void) OCITransCommit(svchp, errhp, (ub4) 0);

  return OCI_SUCCESS;
}

论坛徽章:
0
10 [报告]
发表于 2006-09-20 13:18 |只看该作者
sword attach_server(mode, srvhp, errhp, svchp)
ub4 mode;
OCIServer *srvhp;
OCIError *errhp;
OCISvcCtx *svchp;
{
  text *cstring = (text *)"dbsrv1";
把cstring数据库服务名修改本地的服务名即可调试
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP