在pb中调用oracle 的函数,请教pb中调用oracle 函数和过程!

oracle写好的函数可以在SQL语句中直接调用,比如:你写了一个TRIM函数,然后PB端的SQL中可以这样调用:select col1,... from tab_name where trim(col1) ='';

进行存储过程调用:

PowerBuilder requires a declarative statement to identify the database stored procedure that is being used and a logical name that can be referenced in subsequent SQL statements. The general syntax for declaring a procedure is:

DECLARE logical_procedure_name PROCEDURE  FOR

Oracle_procedure_name(:InParam1,:InParam2, ...)

{USING transaction_object};

where logical_procedure_name can be any valid PowerScript data identifier and Oracle_procedure_name is the name of the stored procedure in the database.

The parameter references can take the form of any valid parameter string that Oracle accepts. PowerBuilder does not inspect the parameter list format except for purposes of variable substitution. The USING clause is required only if you are using a transaction object other than the default transaction object.

You can use Oracle Named or Positional notation to specify the procedure arguments. Positional is simpler to specify, but you must use Named if any output parameters are defined to the left of any input parameters.

Example

If a stored procedure, proc1, is defined as:

CREATE PROCEDURE spm1

(dept varchar2, mgr_name OUT varchar2)

IS lutype varchar2(10);

BEGIN

SELECT manager INTO mgr_name FROM mgr_table

WHERE dept_name = dept;

END;

To declare that procedure for processing within PowerBuilder, you code:

DECLARE dept_proc PROCEDURE FOR

spm1(:dept);

Note that this declaration is a non-executable statement, just like a cursor declaration. Where cursors have an OPEN statement, procedures have an EXECUTE statement.

When the EXECUTE statement executes, the procedure is invoked. The EXECUTE refers to the logical procedure name.

EXECUTE dept_proc;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值