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;