Skip to Main Content
  • Questions
  • print an XMLTYPE Record Type variable


Question and Answer

Chris Saxon

Thanks for the question, shyam.

Asked: February 13, 2019 - 5:22 pm UTC

Last updated: February 22, 2021 - 4:44 pm UTC

Version: oracle 12c

Viewed 1000+ times

You Asked

we have a following definition
TYPE response_t IS RECORD (

A local variable is defined with that record type
lv_resp response_t;

I want to print the value this local variable has stored.I tried dbms_output but dint work.Can you please suggest me an alternative.

and we said...

SQL> set serverout on
SQL> declare
  2    x xmltype;
  3  begin
  4    x := xmltype('<xml><name>Connor</name></xml>');
  6    dbms_output.put_line(x.getstringval());
  7  end;
  8  /

PL/SQL procedure successfully completed.

There's a getclobval as well for bigger ones


  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment



Naresh, February 18, 2021 - 11:50 am UTC

The Answer is correct but I have the huge string so I used getclobval() which is not working. Giving error message "PL/SQL: numeric or value error".
Chris Saxon
February 22, 2021 - 4:44 pm UTC

Please could you show us a complete example of what you're doing?

More to Explore


New to good database design? Check out Chris Saxon's full fundamentals class.