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.
- CreateOr replaceProcedureP_test
- (
- ID inInt,
- 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;