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!

Integer-Support in ANYDATA missing

Jan GorkowOct 15 2020 — edited Oct 26 2020

Hello community,
during development of a generic interface some weeks ago I noticed, that the ANYDATA-Type seems to not fully support INTEGER. I tested the following example code agains an Oracle DB 19c:

CREATE OR REPLACE TYPE type_object IS OBJECT
(
  string VARCHAR2 (3 CHAR),
  num NUMBER,
  int INTEGER
);
DECLARE
  v_object  type_object
         := NEW type_object (string => 'abc', num => 1, int => 2);
  v_anydata  ANYDATA := anydata.convertobject (obj => v_object);
  v_string  VARCHAR2 (3 CHAR);
  v_num    NUMBER;
  v_result  PLS_INTEGER;
BEGIN
  v_anydata.piecewise ();
  v_result := v_anydata.getvarchar2 (c => v_string);
  dbms_output.put_line (v_string);
  v_result := v_anydata.getnumber (num => v_num);
  dbms_output.put_line (v_num);
  
  --Following Statement results in ORA-22626
  v_result := v_anydata.getnumber (num => v_num);
  dbms_output.put_line (v_num);
END;
/

Full INTEGER support would be great and I don't understand, why this is not implemented. There is no ANYDATA.getinteger - method yet. This would be usefull for the implementation af generic interfaces or helper routines, so you are able to give any object to a central routine and access the individual attributes programmatically.
What do you think about this? Do you have any ideas about this problem?
Thank you very much in advance,
best regards
Jan

This post has been answered by Solomon Yakobson on Oct 15 2020
Jump to Answer
Comments
Post Details
Added on Oct 15 2020
4 comments
290 views