Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Calling stored procedures in c++ via odbc

Calling stored procedures in c++ via odbc

From: harp <hmetu_at_gmx.net>
Date: 10 Feb 2005 01:51:20 -0800
Message-ID: <1108029080.161183.16340@z14g2000cwz.googlegroups.com>


I have the following done in sql*plus

DROP PACKAGE ODBCRefCus;
CREATE PACKAGE ODBCRefCus AS
  TYPE firstname_cus IS REF CURSOR;
  TYPE familyname_cus IS REF CURSOR;
  TYPE address_cus IS REF CURSOR;
  TYPE telno_cus IS REF CURSOR;

PROCEDURE spEmpCus(Firstname IN OUT firstname_cus, Familyname IN OUT familyname_cus, Address IN OUT address_cus, Telno IN OUT telno_cus, comp IN
VARCHAR2);
END;
/

CREATE PACKAGE BODY ODBCRefCus AS
PROCEDURE spEmpCus(Firstname IN OUT firstname_cus, Familyname IN OUT familyname_cus, Address IN OUT address_cus, Telno IN OUT telno_cus, comp IN
VARCHAR2)
    AS

      BEGIN
         IF NOT Firstname%ISOPEN
         THEN
             OPEN Firstname for SELECT firstname FROM customers WHERE
firm = comp;
         END IF;
         IF NOT Familyname%ISOPEN
	 THEN
	     OPEN Familyname for SELECT familyname FROM customers WHERE firm =
comp;
         END IF;
         IF NOT Address%ISOPEN
	 THEN
	     OPEN Address for SELECT address FROM customers WHERE firm = comp;

         END IF;
         IF NOT Telno%ISOPEN
	 THEN
	     OPEN Telno for SELECT telno FROM customers WHERE firm = comp;
         END IF;
      END;

END;
/

I was able to compile.
nd in my c++ program:
Assuming that all about the connections were okay AnsiString stmt = "CALL ODBCRefCus.spEmpCus(?,?,?,?,'firm')";
//AnisString(borlands) is just a string

retcode =
SQLBindParameter(hstmt,1,SQL_PARAM_INPUT_OUTPUT,SQL_C_CHAR,SQL_C_CHAR, sizeof(?),0,?,0,&firstnameId);
My problem is: what type do I use to bind for ? as parameters. If I use AnsiString/string/char* - it gets problem with execution. retcode = SQLExecute(hstmt);
And gives error message of ora-06553: pls-306 wrong number or type of arguments.

NB: I do use oracle9i, c++builder6

I'm quite in need of your help.
Regards,
Harp Received on Thu Feb 10 2005 - 03:51:20 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US