Oracle SQL*PLUS中使用变量
2009-08-31 10:44
495 查看
In C and C++, a function can have optional function arguments. For example,
int printf
(const char *template, ...
)
How about we wrapp this function? For example,
In fact, there is no way to passing the optional arguments of printError to printf. The solution is to use va_list. For this example, we can can use vprintf.
If we want to define some API with optional arguments, we use optional arguments in the exposed API. But for the internal implementation, we should use va_list since va_list can be passed from function definition to function defintion.
For details, you can refer to 12.12.9 Variable Arguments Output Functions
in The GNU C Library Reference Manual
.
int printf
(const char *template, ...
)
How about we wrapp this function? For example,
int printError(const char* template, ...) { // additional logic // an invocation of printf // additional logic }
In fact, there is no way to passing the optional arguments of printError to printf. The solution is to use va_list. For this example, we can can use vprintf.
int printError(const char* template, ...) { // additional logic va_list ap; va_start(ap, template); vprintf(template, ap); va_end(ap); // additional logic }
If we want to define some API with optional arguments, we use optional arguments in the exposed API. But for the internal implementation, we should use va_list since va_list can be passed from function definition to function defintion.
For details, you can refer to 12.12.9 Variable Arguments Output Functions
in The GNU C Library Reference Manual
.
相关文章推荐
- Oracle SQLPlus 一些使用经验记录(设置环境变量和字符串比较)
- 【Linux】Solaris10下安装后Oracle11g的环境变量配置,实现oracle用户下支持sqlplus,lsnrctl等命令
- Oracle 10g的使用【SQLPLUS操作大全】
- Oracle SQL*PLUS命令使用大全
- 使用 Oracle Sql plus的一点经验
- Linux下Oracle的sqlplus中上下左右退格键无法使用
- 【转】[Oracle]SQL*PLUS命令的使用大全
- Oracle笔记(一)sqlplus工具的使用
- 在windows 下为什么可以使用 sqlplus / as sysdba 进入到oracle中。
- Linux环境下使用sqlplus登录Oracle,报'ORA-12547: TNS:lost contact’丢失连接错误
- linux下oracle的sqlplus使用不顺手的解决
- oracle 学习之路,使用sql*plus编写交互命令
- Oracle学习笔记:sqlplus使用ip地址访问Oracle服务器
- ORACLE SQL*PLUS环境变量设置及说明
- 使用OEM,SQL*Plus,iSQL*Plus 管理Oracle实例
- Oracle 10g绿色客户端 plus PL/SQL Developer-搭建方便的Oracle客户端使用环境
- Oracle基本使用----sql*plus常用命令
- Oracle的SQL*PLUS命令的使用大全
- Oracle中sqlplus命令限制(使用自带脚本pupbld.sql)
- [oracle编程]pl/sql --标量 复合变量以及游标的简单使用