Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Attempt to assign item to nested table cause PLS-00382: expression is of wrong type. PLSQL

I have created nested table and I would like to assign item for them. But when I try do this I get an error

Error at line 27, 28: PLS-00382: expression is of wrong type

And 27, 28 line is with the assign.
I have declared a few parameters:

DECLARE
    clubIdFirst NUMBER;
    clubIdSecond NUMBER;

    TYPE clubsIdsArray IS TABLE OF NUMBER;
    nestedclubsIdsArray clubsIdsArray:=clubsIdsArray()

BEGIN
   //assign values to clubIdFirst and clubIdSecond trying assign them to table
   nestedclubsIdsArray .EXTEND(2);
   nestedclubsIdsArray := clubIdFirst;
   nestedclubsIdsArray := clubIdSecond;

Why it takes place?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You forgot to say which element you’re assigning the value to (see lines #11 and 12), e.g.:

SQL> DECLARE
  2      clubIdFirst NUMBER;
  3      clubIdSecond NUMBER;
  4
  5      TYPE clubsIdsArray IS TABLE OF NUMBER;
  6      nestedclubsIdsArray clubsIdsArray:=clubsIdsArray();
  7
  8  BEGIN
  9     --assign values to clubIdFirst and clubIdSecond trying assign them to table
 10     nestedclubsIdsArray .EXTEND(2);
 11     nestedclubsIdsArray (1):= clubIdFirst;
 12     nestedclubsIdsArray (2):= clubIdSecond;
 13  end;
 14  /

PL/SQL procedure successfully completed.

SQL>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading