想大家请教一下,PRO*C里面如何能够调用ORACLE的PACKAGEBODY里的函数呢?非常感谢!

kgww 2003-10-21 09:53:50
想从PRO*C里面调用ORACLE的PACKAGEBODY里的函数!
...全文
90 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
beckhambobo 2004-03-12
  • 打赏
  • 举报
回复
Calling a Stored PL/SQL or Java Subprogram
To call a stored subprogram from your host program, you can use either an anonymous PL/SQL block, or the CALL embedded SQL statement.

Anonymous PL/SQL Block
In the following example, you call a standalone procedure named raise_salary:

EXEC SQL EXECUTE
BEGIN
raise_salary(:emp_id, :increase);
END;
END-EXEC;


Notice that stored subprograms can take parameters. In this example, the actual parameters emp_id and increase are C host variables.

In the next example, the procedure raise_salary is stored in a package named emp_actions, so you must use dot notation to fully qualify the procedure call:

EXEC SQL EXECUTE
BEGIN
emp_actions.raise_salary(:emp_id, :increase);
END;
END-EXEC;


An actual IN parameter can be a literal, scalar host variable, host array, PL/SQL constant or variable, PL/SQL table, PL/SQL user-defined record, procedure call, or expression. However, an actual OUT parameter cannot be a literal, procedure call, or expression.

You must use precompiler option SQLCHECK=SEMANTICS with an embedded PL/SQL block.

In the following example, three of the formal parameters are PL/SQL tables, and the corresponding actual parameters are host arrays. The program calls the stored procedure get_employees repeatedly, displaying each batch of employee data, until no more data is found. This program is available on-line in the demo directory, in the file sample9.pc. A SQL script to create the CALLDEMO stored package is available in the file calldemo.sql.

zlncut 2004-03-12
  • 打赏
  • 举报
回复
可以直接调用,只要include就可以拉
a_stupid_boy 2004-03-12
  • 打赏
  • 举报
回复
dbms_output.put_line(nmber) ;
直接调用包dbms_output中的put_line()函数
kgww 2003-10-21
  • 打赏
  • 举报
回复
能不能给举个例子呀,非常感谢!
Drate 2003-10-21
  • 打赏
  • 举报
回复
如果调用函数,应该是可以直接用的吧,只要你调用这个函数的用户有这个权限就可以了

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧