Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Calling Oracle stored procedures and functions – PB Docs 2022 – PowerBuilder Library

Calling Oracle stored procedures and functions – PB Docs 2022

Calling Oracle stored procedures and functions

Symptom

How do you call Oracle Stored Procedures and Functions from
PowerBuilder?

Environment

Microsoft Windows 7 x64

Solution

Calling Oracle Stored Procs/Functions from PowerBuilder whenever
you want to make a call to an Oracle stored procedure or stored
function, a good approach is to first declare it as an external function
and then invoke it based on that declaration.

  1. Declaring an Oracle Stored Procedure so that PowerBuilder
    Knows About it This function/procedure declaration is done in the
    transaction user object (e.g. n_tr for a PFC App). Once inside the
    transaction user object, choose “Declare-Local External Functions”
    and follow the syntax below.

    1. Stored Procedure (no package)

      The declaration syntax for a stored procedure (on its own,
      outside package) is:

      In example 1.1, the declaration passes a string by value
      (i.e. IN) and a string by reference (i.e. IN OUT or OUT).

      Notes:

      1) if the procedure is not in a package and does not take
      any array parameters, then you can click the procedures button
      to paste in the procedure declaration directly from the
      database.

      2) an optional alias clause can be added to allow
      PowerBuilder to use a different function name from Oracle (see
      alias format used with package declarations).

    2. Procedure inside an Oracle package

      The declaration syntax for a stored procedure inside a
      package is:

      In example 1.2, the declaration passes a string by value
      (i.e. IN) and a string array by reference (i.e. IN OUT or
      OUT).

    3. Stored Function (no package)

      The declaration syntax for a stored function (on its own,
      outside package) is:

      In example 1.3, the declaration passes a string by value
      (i.e. IN) and a string array by reference (i.e. IN OUT or OUT)
      and it returns a long.

      Note: the same notes given for stored procedure
      declarations apply to stored functions.

    4. Function inside an Oracle package

      The declaration syntax for a stored function inside a
      package is:

      In example 1.4, the declaration passes a string by value
      (i.e. IN) and a string array by reference (i.e. IN OUT or OUT)
      and returns a long.

  2. Invoking an Oracle Stored Procedure/Function

    This is the invocation syntax for a stored procedure/function
    that has been declared in the transaction object is shown
    below.

    Notes on Variables passed by Reference

    Dynamically-sized output variables (i.e. strings and arrays)
    must be preallocated up to the size needed. When using this
    invocation method, PowerBuilder does not dynamically allocate the
    space needed for them.

    Array Size Limitation: number of array elements times maximum
    element size cannot exceed 32K.

    1. Invoking a Stored Procedure

      The invocation syntax for a stored procedure is:

      Sample invocation:

    2. SInvoking a Stored Function (shown using an array
      variable)

      The invocation syntax is:

      Sample invocation:


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