user2058738
user2058738

Reputation: 369

How to pass record type value to function argument

May I know how to pass a record type value to a function argument?

Below is my attempt. I'm getting "wrong number or types of arguments in call..." error I've searched but couldn't seem to find definite answer that will help me.

Hope someone can answer.

DECLARE
TYPE attribute_type_record IS RECORD 
(
        name VARCHAR2(100)
       ,value VARCHAR2(400)
       ,ind  integer
);

type attribute_type is table of attribute_type_record index by binary_integer;

sid_att attribute_type;
ret     varchar2(3000);
BEGIN

sid_att(1).name := 'SID_ATTRIBUTES.REFERENCE1';
sid_att(1).value := 'SID_ATTRIBUTES.REFERENCE1';
sid_att(1).ind := '1';

--v_row := sid_attributes_table('SID_ATTRIBUTES.REFERENCE1');

ret := SC$DATA_ENTRY.ins_sid_attributes(sid_att(1).name,
                                        sid_att(1).value,
                                        sid_att(1).ind,
                                        '594191176',
                                        'TEST');

END;


FUNCTION ins_sid_attributes (
      p_sid_attributes_table        sc$data_entry_utilities.attribute_table,
      p_sid_id                      sid_attributes.sid_id%TYPE,
      p_user                   IN   VARCHAR2
   )
      RETURN VARCHAR2
   IS
      error_message   VARCHAR2 (2000);
      v_row           sc$data_entry_utilities.attribute_type;
      empty_row       sc$data_entry_utilities.attribute_type;
      v_order         INTEGER                                := 0;
      v_name          VARCHAR2 (2000);
      cat_table       pkg_utilities.number_table;
-- I did not post the rest of the code of this function since i believe it is irrelevant to the error and to keep it short.                     

Thanks in advance! noth

Upvotes: 1

Views: 1776

Answers (1)

Assuming that the INS_SID_ATTRIBUTES procedure shown above is the one you're actually trying to call, the message seems reasonable to me. INS_SID_ATTRIBUTES, as shown above, wants three parameters:

  1. A SC$DATA_ENTRY_UTILITIES.ATTRIBUTE_TABLE
  2. A SID_ATTRIBUTES.SID_ID%TYPE
  3. A VARCHAR2

But in the call you're passing it:

  1. A VARCHAR2
  2. A VARCHAR2
  3. An INTEGER
  4. A VARCHAR2
  5. A VARCHAR2

So you're passing five arguments to a procedure that only accepts three, and the values you're passing are of the wrong types.

Share and enjoy.

Upvotes: 1

Related Questions