Oracle Objects for OLE C++ Class Library
Release 9.2

Part Number A95896-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

Example: Multiple Cursor Return

This example uses the package GetEmpData(). Make sure that this package will be available in the database by executing empcur.sql script located in the ORACLE_BASE\ORACLE_HOME\oo4o directory.

Note: For more information about sample code, see Sample Code and Applications.

// first we need a database

ODatabase odb("exampledb", "scott", "tiger");

OParameterCollection params = odb.GetParameters();

// now add a parameter named 'DEPTNO' to the database

params.Add("DEPTNO", 20, OPARAMETER_INVAR, OTYPE_NUMBER);

// now add a parameter named 'EMPCURSOR' to the database

params.Add("EMPCURSOR", "", OPARAMETER_OUTVAR, OTYPE_CURSOR);

//Execute the SQL statement

odb.ExecuteSQL("BEGIN Employee.GetEmpData (:DEPTNO,:EMPCURSOR); END;");

//retrieve the EMPCUSRSOR oparameter class

OParameter EmpcurParam = params.GetParameter("EMPCURSOR") ;

//retrieve odyn class associated with empcursor

ODynaset EmpcurDynaset;

EmpcurParam.GetValue(&EmpcurDynaset);

//now get the field value

const char *ename;

OField Enamefld = EmpcurDynaset.GetField("ename");

Enamefld.GetValue(&ename);

AfxMessageBox(ename);

//removing this will result in destroying the dynaset associated with cursor

params.Remove("EMPCURSOR");

params.Remove("DEPTNO");


 
Oracle
Copyright © 1998, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback