cancel
Showing results for 
Search instead for 
Did you mean: 

Powerbuilder application error R0002

Former Member
0 Kudos

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'

  1.   From the Objects tab in the New dialog box, define a standard class user object inherited from the built-in Transaction object.
  2. 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.

  3. Save the user object.

  4. In the Application painter, specify the user object you defined as the default global variable type for SQLCA.

  5. 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

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

have you tried to pass all the arguments when you call the procedure?

Former Member
0 Kudos

Looks like you have not connected to the database yet using the transaction object (proccall) you have created.

Former Member
0 Kudos

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 ;

former_member190719
Active Contributor
0 Kudos

Can you show us the actual code you are using in PB?  Let's see the RPCFUNC declaration and the call to the function.

Former Member
0 Kudos

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

arnd_schmidt
Active Contributor
0 Kudos

Because your global SQLCA transaction object is already of the type "proccall" (setting in the application painter), you just have to call:

SQLCA.PROCESSATTENDANCE('1' , '21/10/2014' , '20/11/2014')

Also make sure that your arguments match.

hth

Arnd

Former Member
0 Kudos

I have tried SQLCA.PROCESSATTENDANCE('1' , '21/10/2014' , '20/11/2014') also.

But i get the following error

Error:C0051 unknown function name: processattendance

Please help

former_member190719
Active Contributor
0 Kudos

That would mean you did this step wrong:

  1. In the Application painter, specify the user object you defined as the default global variable type for SQLCA.

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.

Former Member
0 Kudos

Just to add to what Bruce said. You should see the proc show up in the intellisense when you type the dot after sqlca. If you don't see it (or any others you defined) as an rpc you've probably got something wrong.

hth,

Mark

Former Member
0 Kudos

Hi,

Have you tried tracing your connection?

Does it actually connect to DB?

Have you regenerated objects?

Chris