Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Posts
    10

    Unanswered: setDataBufferArray in place of setVector/getVector

    I was using setvector /getvector approach for calling stored procedure than I came to know that I could use setDataBufferArray for better performance, so I changed my code and after that I am getting error

    Code:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'VOLUME_F2'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    I wrote a test program also but in that also I am getting the same error

    here is the test program I wrote for stored procedure
    Code:
    SQL>  CREATE OR REPLACE TYPE CHAR100_ARR_5 AS    TABLE  OF     VARCHAR2(100)
      2  /
    
    Type created.
    
    SQL> CREATE OR REPLACE PROCEDURE VOLUME_F2
      2  (
      3  BROKER_LIST IN CHAR100_ARR_5,
      4  STATUS OUT INTEGER
      5  )
      6  AS
      7  BEGIN
      8  STATUS:=10;
      9  END;
     10  /
    
    Procedure created.

    this is the C++ program which I am using to call the stored procedure

    Code:
    #include<iostream>
    #include<occi.h>
    using namespace oracle::occi;
    using namespace std;
    
    int main()
    {
    
    const string userName = "test";
    const string password = "abc123";
    const string connectString = "";
    
    Environment *env = Environment::createEnvironment();
    Connection *conn = env->createConnection(userName, password, connectString);
    Statement *stmt;
    
    try
    {
    stmt = conn->createStatement("BEGIN VOLUME_F2(:1,:2); END;");
    }
    
    
    catch(SQLException ex)
        {
         
         cout<<"Error number: "<<  ex.getErrorCode() << endl;
         cout<<ex.getMessage() << endl;
        }
    
    
    char str[5][100]={"Richard P. Pila","Elodia V. Holen","Charlene S. Markus","Elwood L. Romaine","Laci N. Mcneece"};
    
    ub2 strlength[5];
    for (int i=0;i<5;i++)
    strlength[i]=strlen(str[i])+1;
    ub4 a=5;
    
    try{ stmt->setDataBufferArray(1,str,OCCI_SQLT_STR,5,&a,100,strlength,NULL,NULL); }
    catch(SQLException ex)
        {
         
         cout<<"Error number: "<<  ex.getErrorCode() << endl;
         cout<<ex.getMessage() << endl;
        }
    
    
    try {stmt->registerOutParam(2,OCCIINT,sizeof(int));}
    catch(SQLException ex)
        {
         
         cout<<"Error number: "<<  ex.getErrorCode() << endl;
         cout<<ex.getMessage() << endl;
        }
    
    
    
    cout<<"before executing the statement "<<endl;
    
    try { stmt->executeUpdate(); }
    catch(SQLException ex)
        {
         
         cout<<"Error number: "<<  ex.getErrorCode() << endl;
         cout<<ex.getMessage() << endl;
        }
    
    cout<<"after executing the statement "<<endl;
    
    cout<<"STATUS "<<stmt->getInt(2)<<endl;
    
    Environment::terminateEnvironment(env);
    }

    this is the output of this this program

    Code:
    before executing the statement
    Error number: 6550
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'VOLUME_F2'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    
    after executing the statement
    STATUS 0
    How can I solve this error

    Thanks in Advance

  2. #2
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    Check out this document on Oracle and C++: http://tinyurl.com/bptpcvh

  3. #3
    Join Date
    Dec 2011
    Posts
    10
    That PPT only tells about SetDataBuffer ,there is nothing about SetDataBufferArray in that ppt.

    It will be very helpful If somebody can explain how to use SetDataBufferArray .
    I Searched lot about that but all in vain

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •