Solved

wrong number of argument error when calling report from forms 11gR2

Posted on 2015-02-03
12
438 Views
Last Modified: 2015-02-06
hi am trying to call report in form 11gR2

this is the procedure
PROCEDURE run_reports (rep_id IN Varchar2,
                       command_id Varchar2,
                       unit_id IN Varchar2,
                       dept_id IN Varchar2,
                       mec_id IN Varchar2,
                       syc_id IN Varchar2,
                       baseline_id IN Varchar2,
                       fail_id IN Varchar2,
                       upper_dev IN Varchar2,
                       lower_dev IN Varchar2,
                       min_avail IN Varchar2,
                       start_date IN Varchar2,
                       end_date IN Varchar2,
                       combined_mec IN Varchar2,
                       nsn IN Varchar2) IS
  pl_id ParamList;
/* */  
BEGIN
  pl_id := Get_Parameter_List('tmpdata');
  IF NOT Id_Null(pl_id) THEN
      Destroy_parameter_list(pl_id);
  END IF;
  pl_id := Create_parameter_list('tmpdata');
  
  Add_parameter(pl_id, 'COMMAND' ,TEXT_PARAMETER, command_id);
  Add_parameter(pl_id, 'UNIT' ,TEXT_PARAMETER, unit_id);
  Add_parameter(pl_id, 'DEPARTMENT' ,TEXT_PARAMETER, dept_id);
  Add_parameter(pl_id, 'MAIN_EQUIPMENT_CODE' ,TEXT_PARAMETER, mec_id);
  Add_parameter(pl_id, 'SYSTEM_CODE' ,TEXT_PARAMETER, syc_id);
  Add_parameter(pl_id, 'BASELINE' ,TEXT_PARAMETER, baseline_id);
  Add_parameter(pl_id, 'FAILURE' ,TEXT_PARAMETER, fail_id); 
  Add_parameter(pl_id, 'UPPER' ,TEXT_PARAMETER, upper_dev);
  Add_parameter(pl_id, 'LOWER' ,TEXT_PARAMETER, lower_dev);
  Add_parameter(pl_id, 'MIN_AVAIL' ,TEXT_PARAMETER, min_avail);
  Add_parameter(pl_id, 'START_DATE' ,TEXT_PARAMETER, start_date);
  Add_parameter(pl_id, 'END_DATE' ,TEXT_PARAMETER, end_date);
  Add_parameter(pl_id, 'COMBINED_MEC' ,TEXT_PARAMETER, combined_mec);
  Add_parameter(pl_id, 'NSN' ,TEXT_PARAMETER, nsn);
  Add_parameter(pl_id, 'PARAMFORM' ,TEXT_PARAMETER, 'NO');
  Add_parameter(pl_id, 'ORIENTATION' ,TEXT_PARAMETER, 'LANDSCAPE');
  Add_parameter(pl_id, 'DESTYPE' ,TEXT_PARAMETER, 'PREVIEW');

 -- RUN_PRODUCT(REPORTS, rep_id, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
  
 --  RUN_REPORT_OBJECT(REPORTS, rep_id, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
   
   SET_REPORT_OBJECT_PROPERTY(REPORTS, rep_id, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);

am geting wrong number of argument

END;

Open in new window

0
Comment
Question by:chalie001
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 16

Expert Comment

by:Wasim Akram Shaik
ID: 40586239
As error suggests.. you are trying to invoke/call a procedure which has either more or less number of arguments which it is expected as input..

check the procedure call..i think you had posted the procedure which you think the error message had reported.. where in you have to correct the code where this procedure is being called..

ie., in a simple way..

count the number of parameters from the invoking code, count the number of parameters in the actual procedure code.. both should match..
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40586803
I'm unable to locate the specific document that shows the allowed syntax for SET_REPORT_OBJECT_PROPERTY but all the examples I find have report_id as the first parameter.

I see no examples with a parameter before it so my guess it is REPORTS that is causing the error.
0
 

Author Comment

by:chalie001
ID: 40587915
i did like this  SET_REPORT_OBJECT_PROPERTY(rep_id, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL); but still geting error am not calling a procedure am calling a report
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:chalie001
ID: 40587918
even this still geve error
RUN_REPORT_OBJECT(rep_id, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
0
 

Author Comment

by:chalie001
ID: 40587982
i use this and it works
RP2RRO.setDestype( 'PREVIEW');

  rp2rro.rp2rro_run_product(REPORTS, rep_id, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 40588000
slightwv is right about first parameter:
 
report_id
     Specifies the unique ID of the report to be run. You can get the report ID for a particular report using the Built-in FIND_REPORT_OBJECT

There are another problems:
1) this is wrong: SET_REPORT_OBJECT_PROPERTY(rep_id, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
because SET_REPORT_OBJECT_PROPERTY built-in has only 3 parameters.

This example is from on-line help:
SET_REPORT_OBJECT_PROPERTY Examples

DECLARE
 repid REPORT_OBJECT;
 report_prop VARCHAR2(20);
BEGIN
 repid := find_report_object('report4');
 SET_REPORT_OBJECT_PROPERTY(repid, REPORT_EXECUTION_MODE, BATCH);
 SET_REPORT_OBJECT_PROPERTY(repid, REPORT_COMM_MODE, SYNCHRONOUS);
 SET_REPORT_OBJECT_PROPERTY(repid, REPORT_DESTYPE, FILE);
END;

2) RUN_REPORT_OBJECT(rep_id, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL); is also wrong, because RUN_REPORT_OBJECT built-in has 1 or 2 parameters - second is parameter list.
This example is also from on-line help:

RUN_REPORT_OBJECT Example
 DECLARE
 repid REPORT_OBJECT;
 v_rep VARCHAR2(100);
 rep_status VARCHAR2(20);
BEGIN
 repid := FIND_REPORT_OBJECT('report4');
 v_rep := RUN_REPORT_OBJECT(repid); --or  v_rep := RUN_REPORT_OBJECT(repid,pl_id);
 ...
END;
0
 

Author Comment

by:chalie001
ID: 40588489
i did this
 repid := FIND_REPORT_OBJECT('REPORTS');
    v_rep := RUN_REPORT_OBJECT(repid,pl_id);

but am geting this error
expression 'REPID' cannot be used as an assigment
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40588499
Please show the complete code.
0
 

Author Comment

by:chalie001
ID: 40588556
PROCEDURE run_reports (rep_id IN Varchar2,
                       command_id Varchar2,
                       unit_id IN Varchar2,
                       dept_id IN Varchar2,
                       mec_id IN Varchar2,
                       syc_id IN Varchar2,
                       baseline_id IN Varchar2,
                       fail_id IN Varchar2,
                       upper_dev IN Varchar2,
                       lower_dev IN Varchar2,
                       min_avail IN Varchar2,
                       start_date IN Varchar2,
                       end_date IN Varchar2,
                       combined_mec IN Varchar2,
                       nsn IN Varchar2,
                       repid REPORT_OBJECT,
                       v_rep VARCHAR2,
                       rep_status VARCHAR2) IS
  pl_id ParamList;
/* */  
BEGIN
  pl_id := Get_Parameter_List('tmpdata');
  IF NOT Id_Null(pl_id) THEN
      Destroy_parameter_list(pl_id);
  END IF;
  pl_id := Create_parameter_list('tmpdata');
  
  Add_parameter(pl_id, 'COMMAND' ,TEXT_PARAMETER, command_id);
  Add_parameter(pl_id, 'UNIT' ,TEXT_PARAMETER, unit_id);
  Add_parameter(pl_id, 'DEPARTMENT' ,TEXT_PARAMETER, dept_id);
  Add_parameter(pl_id, 'MAIN_EQUIPMENT_CODE' ,TEXT_PARAMETER, mec_id);
  Add_parameter(pl_id, 'SYSTEM_CODE' ,TEXT_PARAMETER, syc_id);
  Add_parameter(pl_id, 'BASELINE' ,TEXT_PARAMETER, baseline_id);
  Add_parameter(pl_id, 'FAILURE' ,TEXT_PARAMETER, fail_id); 
  Add_parameter(pl_id, 'UPPER' ,TEXT_PARAMETER, upper_dev);
  Add_parameter(pl_id, 'LOWER' ,TEXT_PARAMETER, lower_dev);
  Add_parameter(pl_id, 'MIN_AVAIL' ,TEXT_PARAMETER, min_avail);
  Add_parameter(pl_id, 'START_DATE' ,TEXT_PARAMETER, start_date);
  Add_parameter(pl_id, 'END_DATE' ,TEXT_PARAMETER, end_date);
  Add_parameter(pl_id, 'COMBINED_MEC' ,TEXT_PARAMETER, combined_mec);
  Add_parameter(pl_id, 'NSN' ,TEXT_PARAMETER, nsn);
  Add_parameter(pl_id, 'PARAMFORM' ,TEXT_PARAMETER, 'NO');
  Add_parameter(pl_id, 'ORIENTATION' ,TEXT_PARAMETER, 'LANDSCAPE');
  Add_parameter(pl_id, 'DESTYPE' ,TEXT_PARAMETER, 'PREVIEW');

repid := FIND_REPORT_OBJECT('REPORTS');
v_rep := RUN_REPORT_OBJECT(repid,pl_id);


am geting wrong number of argument

is there a way i can do this without adding this 3
repid REPORT_OBJECT,
                       v_rep VARCHAR2,
                       rep_status VARCHAR2 
as this procedure is been called somewhere

END;
                                  

Open in new window

0
 

Author Comment

by:chalie001
ID: 40588558
am geting expression 'REPID' cannot be used as an assigment
not am geting wrong number of argument
0
 
LVL 22

Assisted Solution

by:Helena Marková
Helena Marková earned 250 total points
ID: 40588572
I would say that
repid REPORT_OBJECT
cannot be used as input parameter in your procedure:
PROCEDURE run_reports (rep_id IN Varchar2,
                       command_id Varchar2,
                       unit_id IN Varchar2,
                       dept_id IN Varchar2,
                       mec_id IN Varchar2,
                       syc_id IN Varchar2,
                       baseline_id IN Varchar2,
                       fail_id IN Varchar2,
                       upper_dev IN Varchar2,
                       lower_dev IN Varchar2,
                       min_avail IN Varchar2,
                       start_date IN Varchar2,
                       end_date IN Varchar2,
                       combined_mec IN Varchar2,
                       nsn IN Varchar2,
                       repid REPORT_OBJECT,
                       v_rep VARCHAR2,
                       rep_status VARCHAR2) IS
  pl_id ParamList;
and this is the reason why it is not recognized in a procedure body.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 40588604
By default parameters to a procedure are IN and thus, read only.

If you make it IN OUT you should be able to assign it a value.
or
create a local variable and assign it.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question