Step 2: declare the stored procedure as an external function – PB Docs 125

Step 2: declare the stored procedure as an external function

FUNCTION or SUBROUTINE declaration

You can declare a non-result-set database stored procedure
as an external function or external subroutine in a PowerBuilder
application. If the stored procedure has a return value, declare
it as a function (using the FUNCTION keyword).
If the stored procedure returns nothing or returns VOID,
declare it as a subroutine (using the SUBROUTINE keyword).

RPCFUNC and ALIAS FOR keywords

You must use the RPCFUNC keyword
in the function or subroutine declaration to indicate that this
is a remote procedure call (RPC) for a database stored procedure
rather than for an external function in a dynamic library. Optionally, you
can use the ALIAS FOR “spname expression
to supply the name of the stored procedure as it appears in the
database if this name differs from the one you want to use in your
script.

For complete information about the syntax
for declaring stored procedures as remote procedure calls, see the
chapter on calling functions and events in the PowerScript
Reference
.

proc.png To declare stored procedures as external functions
for the user object:

  1. In the Script view in the User Object painter,
    select [Declare] from the first list and Local
    External Functions from the second list.

  2. Place your cursor in the Declare Local External
    Functions view. From the pop-up menu or the Edit menu, select Paste
    Special>SQL>Remote
    Stored Procedures.

    PowerBuilder loads the stored procedures from your database
    and displays the Remote Stored Procedures dialog box. It lists the
    names of stored procedures in the current database.

    datrnsp.gif
  3. Select the names of one or more stored procedures
    that you want to declare as functions for the user object, and click
    OK.

    PowerBuilder retrieves the stored procedure declarations from
    the database and pastes each declaration into the view.

    For example, here is the declaration that displays on one
    line when you select sp_addlanguage:

  4. Edit the stored procedure declaration as needed
    for your application.

    Use either of the following syntax formats to declare the
    database remote procedure call (RPC) as an external function or
    external subroutine (for details about the syntax, see the PowerScript
    Reference
    ):

    Here is the edited RPC function declaration for sp_addlanguage:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x