本文整理汇总了C++中otl_connect类的典型用法代码示例。如果您正苦于以下问题:C++ otl_connect类的具体用法?C++ otl_connect怎么用?C++ otl_connect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了otl_connect类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
otl_connect::otl_initialize(); // initialize OCI environment
try{
db.rlogon("scott/tiger"); // connect to Oracle
otl_cursor::direct_exec
(db,
"CREATE OR REPLACE PACKAGE pkg_test IS "
" TYPE my_numeric_table IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; "
" TYPE my_varchar_table IS TABLE OF VARCHAR2(31) INDEX BY BINARY_INTEGER; "
" TYPE my_char_table IS TABLE OF CHAR(31) INDEX BY BINARY_INTEGER; "
" "
" PROCEDURE prc_test(v1 IN OUT my_numeric_table, "
" v2 OUT my_varchar_table, "
" v3 OUT my_char_table); "
" "
"END; "
);
otl_cursor::direct_exec
(db,
"CREATE OR REPLACE PACKAGE BODY pkg_test IS "
" "
" PROCEDURE prc_test(v1 IN OUT my_numeric_table, "
" v2 OUT my_varchar_table, "
" v3 OUT my_char_table) "
" IS "
" BEGIN "
" FOR i IN 1..v1.last LOOP "
" v1(i) := v1(i)+100; "
" END LOOP; "
" v1(v1.last+1) := 0; "
" v2(1) := 'Hello'; "
" v2(2) := 'World'; "
" v2(3) := '!!!'; "
" v3(1) := 'Hello'; "
" v3(2) := 'World'; "
" v3(3) := '!!!'; "
" END; "
" "
"END; "
);
plsql();
}
catch(otl_exception& p){ // intercept OTL exceptions
cerr<<p.msg<<endl; // print out error message
cerr<<p.stm_text<<endl; // print out SQL that caused the error
cerr<<p.var_info<<endl; // print out the variable that caused the error
}
db.logoff(); // disconnect from Oracle
return 0;
}
开发者ID:008fy,项目名称:otl,代码行数:61,代码来源:ex313_oci7.cpp
注:本文中的otl_connect类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论