I have been using Mysql and Oracle databases for so many years. This time I have to use the C/C ++ language to call the Oracle stored procedure, so I am too lazy to look at the OCI API, I went online to find someone else's encapsulated library, and finally found this ocicpplib. I downloaded it and looked at it. It's good and easy to use. The following example shows how to use this database to call a stored procedure. If you call other SQL statements, you will not be able to use it. It is very easy to read the demo by yourself.
Ocicpplib database is: http://ocicpplib.sourceforge.net/
The following uses this simple stored procedure for testing. There are two output parameters: string and integer.
- CREATE OR REPLACE PROCEDUREP_TEST
- (
- IDIN Int,
- Name OUTVarchar2,
- ResultOUT Int
- )
- IS
- TmpVar NUMBER;
- /*************************************** ***************************************
- **************************************** **************************************/
- BEGIN
- TmpVar: = 0;
- Name: ='Www .csdn.net';
- Result: = 123456;
- EXCEPTION
- WHENNO_DATA_FOUNDTHEN
- NULL;
- WHENOTHERSTHEN
- -- Consider logging the error and then re-raise
- RAISE;
- ENDP_TEST;