Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to execute a Package/Function in PB ?

Status
Not open for further replies.

vulcanjena

Programmer
May 22, 2003
39
0
0
PR
I'm using ORACLE9 with PB9.
I have a package defined with many functions for a massive calculations. How can I execute that package in PB scipt ?

 
Declare it as an local external function for your transaction object and use it as a regular function. Use the right mouse button popup menu and choose:

Paste Special -> SQL -> Remote Stored Procedure(s)...


---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
The script for the packages/function is like shown below.

//---------------
BEGIN
IF cmo_utilities.cmo_calculate_massive THEN
dbms_output.put_line(' Recalculate Process finished successfully ');
ELSE
dbms_output.put_line(' Recalculate Process has errors. Please check logs in CMO_LOGS table ');
END IF;
COMMIT;
END;
//---------------

cmo_calculate_massive is the function within
the package cmo_utilities.

I'll appereciate if you can tell me how can I declare it as
a function and execute that script ?

Thanks in advance.
JENA
 
You may declare local external functions in your transaction object as under:

FUNCTION boolean CalculateMassive() RPCFUNC ALIAS FOR &quot;<user>.CMO_UTILITIES.CMO_CALCULATE_MASSIVE&quot;
SUBROUTINE PutLine ( string as_Line ) RPCFUNC ALIAS FOR &quot;SYS.DBMS_OUTPUT.PUT_LINE&quot;

Or you may declare them in your scripts:

DECLARE CalculateMassive PROCEDURE for <user>.CMO_UTILITIES.CMO_CALCULATE_MASSIVE
DECLARE PutLine PROCEDURE for SYS.DBMS_OUTPUT.PUT_LINE

and call the functions just like any other function:

IF CalculateMassive() THEN
PutLine( ... )
END IF

Subroutines are for functions that don't return any value.

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top