Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass an array of strings to a stored procedure?

3317624May 19 2017 — edited May 19 2017

below  is my Procedure and I want to execute this procedure from SQL developer. When ever I pass data to req_params      I' am getting 'Wrong number/type of arguments' error.

Please let me know how to pass values and execute this procedure to see the output.

  type REQ_PARAMS_ARRAY IS VARRAY(4) OF VARCHAR2(50);

  PROCEDURE test1(

      p_sso           NUMBER ,

      p_timecard_date DATE ,

      req_params      REQ_PARAMS_ARRAY, 

      timecard_rec OUT RECORDSET ,

      timecard_act_rec OUT RECORDSET )

  AS

    v_timecard_id NUMBER;

    v_timecard_from_dt DATE;

    v_timecard_to_dt DATE;          

   

  BEGIN

    --req_params := REQ_PARAMS_ARRAY(); 18-MAY: To be used for executing the procedure / testing

   

    v_timecard_from_dt:=p_timecard_date; 

    v_timecard_to_dt:=p_timecard_date;

     

   

    gettimecard(p_sso, v_timecard_from_dt, v_timecard_to_dt,timecard_rec);

   

  

          FOR i IN req_params.FIRST .. req_params.LAST LOOP

            IF req_params(i) = 'ALL' THEN

             gettimecardactivities(p_sso, v_timecard_from_dt, v_timecard_to_dt,timecard_act_rec );

             RETURN;

            END IF;

          END LOOP;

          FOR i IN 1..req_params.count LOOP 

          IF req_params(i)='ACTIVITIES' THEN

              gettimecardactivities(p_sso, v_timecard_from_dt, v_timecard_to_dt,timecard_act_rec );    

          END IF;

    END LOOP;      

  END test1;

This post has been answered by AndrewSayer on May 19 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 16 2017
Added on May 19 2017
6 comments
3,975 views