on 12-13-2014 4:35 PM
Hi I am unable to call an oracle procedure from power builder 12.5 classic.
I am trying to call an oracle procedure Processattendance which has three String parameters employeeid, startdate and end date
As per the following instrucrtions in powerbuilder help, i have created a user object 'proccall'
In the Script view in the User Object painter, use the RPCFUNC keyword to declare the stored procedure as an external function or subroutine for the user object.
Save the user object.
In the Application painter, specify the user object you defined as the default global variable type for SQLCA.
Code your PowerBuilder application to use the user object.
In the window i use following statement to call procedure.
proccall.PROCESSATTENDANCE('1' , '21/10/2014' , '20/11/2014')
The application compile successfully.
But when i run the application, i get the error.
Powerbuilder application error R0002
Application terminated.
Error: Null object reference at line 14 in clicked even of object cb_1 of w_attendanceprocessing.
I get the same error even when i hardcode the parameter.
The same statement works in an sql editor.
Please help
have you tried to pass all the arguments when you call the procedure?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looks like you have not connected to the database yet using the transaction object (proccall) you have created.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We can try a work around as follows.
First you prepare the staging area using your transaction object
integer var1, ReturnVal
string var2
PREPARE SQLSA FROM "execute @rc = myproc @parm1=?, @parm2=? OUTPUT ";
DESCRIBE SQLSA INTO SQLDA ;
DECLARE my_proc DYNAMIC PROCEDURE FOR SQLSA ;
SetDynamicParm(SQLDA, 1, var1)
SetDynamicParm(SQLDA, 2, var2)
EXECUTE DYNAMIC my_proc USING DESCRIPTOR SQLDA ;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you show us the actual code you are using in PB? Let's see the RPCFUNC declaration and the call to the function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for the reply
Here is the code
subroutine PROCESSATTENDANCE(string BOOTHCODES,string CLASSCODES,string CATEGORYCODES,string EMPLOYEE_IDS,string PRFROMDATE,string PRTILLDATE) RPCFUNC ALIAS FOR PROCESSATTENDANCE.
I have created it using paste special-->sql-->remote stored procedure.
Actually it was as follows
subroutine PROCESSATTENDANCE(string BOOTHCODES,string CLASSCODES,string CATEGORYCODES,string EMPLOYEE_IDS,string PRFROMDATE,string PRTILLDATE) RPCFUNC ALIAS FOR "~"ATTENDANCE~".~"PROCESSATTENDANCE~"" (Even when i use it as such i get the same error)
I have edited it as
subroutine PROCESSATTENDANCE(string BOOTHCODES,string CLASSCODES,string CATEGORYCODES,string EMPLOYEE_IDS,string PRFROMDATE,string PRTILLDATE) RPCFUNC ALIAS FOR PROCESSATTENDANCE.
Inthe window i have hardcoded the parameters as follows still not working
proccall.PROCESSATTENDANCE('1' , '21/10/2014' , '20/11/2014')
Thank you
That would mean you did this step wrong:
If the class that the application uses to create SQLCA from is proccall, then the function you declared should work when you access as a method of SQLCA.
Hi,
Have you tried tracing your connection?
Does it actually connect to DB?
Have you regenerated objects?
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.