#include <iostream> #include "OCILIB.HPP" Using namespace std;using namespace ocilib; #pragma comment (lib, "Ociliba.lib") #pragma comment (lib, "Ocilibw.lib") Int main () { try { int ncout = 0, iin = 11; string sout,sin = "input parameter value"; Environment::initialize (); Connection con ("server", "id", "password"); Statement st (con); St. Prepare ("begin Stored procedure name (: Nout, :sout, :iin, :sin); end;"); St. Bind (Otext (": Nout"), nout, bindinfo::out); Bind (Otext (": Sout"), sout, 256, bindinfo::out); Bind (Otext (": iin"), iin, bindinfo::in); Bind (Otext (": Sin"), sin, static_cast<unsigned int> (Sin.size ()), bindinfo::in); Executeprepared (); cout<< nout&Nbsp;<< sout <<endl; } catch (STD::EXCEPTION&NBSP;&EX) { } Environment::cleanup (); return 0;}
Among them nout,: sout,: iin,: Sin, respectively, represents the output of the int type in the stored procedure, the output of the string type, the input of int type and the input of string type; Note the first general of C + + and linker to be aware of the last project properties in Projict. Add the Include and Lib libraries, respectively.
This article is from the "Learning Records" blog, so be sure to keep this source http://6941523.blog.51cto.com/6931523/1672116
Connecting Oracle execution stored procedures via Ocilib