How To Declare Function Call
- How-to
- Olan Knight
- PowerBuilder
- Thursday, 21 July 2022 09:27 PM UTC
PowerBuilder 2019R3 b2703
Windows 64 bit platform
PostgreSQL database
I have declared a FUNCTION in the PG database as follows:
f_cabs_glextract_master (vin_date IN character varying, session_id OUT character varying)
What I need to know is how to both DECALRE and to CALL this function from my PowerBuilder code. It's not in a DLL, it's in the database.
The goal is to run the function, then read the output variable "session_id" so I can use it in my PB code.
Thank you!
~~~~~~~~~~~~~~~~~
Note that for a stored procedure, this works; sqlcG is the transaction object connected to the PG database:
// Start the dynamic call to run the stored procedure
DECLARE seq_cursor1 PROCEDURE FOR sp_cabs_glextract_master
@vIn_Date = :ls_date
USING SQLCG;
EXECUTE seq_cursor1;
If sqlcG.SQLCode < 0 Then
ls_hdr = 'Error Calling Stored Procedure'
ls_err = 'Error running seq_cursor1(): ~r~n~r~n' + sqlcG.SQLErrText
GOTO Exit_script
End If
<...... code ....>
Exit_script:
// Close the cursor
CLOSE seq_cursor1;
IF (ls_err = "") THEN
sqlcG.of_commit();
ELSE
sqlcG.of_Rollback()
cb_connect.POST SetFocus ()
END IF
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.