How to call the Oracle stored procedure in the C/C ++ encapsulation library ocicpplib

Source: Internet
Author: User

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.

  1. CREATE OR REPLACE PROCEDUREP_TEST
  2. (
  3. IDIN Int,
  4. Name OUTVarchar2,
  5. ResultOUT Int
  6. )
  7. IS
  8. TmpVar NUMBER;
  9. /*************************************** ***************************************
  10. **************************************** **************************************/
  11. BEGIN
  12. TmpVar: = 0;
  13. Name: ='Www .csdn.net';
  14. Result: = 123456;
  15. EXCEPTION
  16. WHENNO_DATA_FOUNDTHEN
  17. NULL;
  18. WHENOTHERSTHEN
  19. -- Consider logging the error and then re-raise
  20. RAISE;
  21. ENDP_TEST;
  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.