Home > other >  PL/SQL XMLTYPE taking input from user
PL/SQL XMLTYPE taking input from user

Time:12-25

I'm getting below error report when passing below xmlsequence in the bind tab for :name value.

<name> 
       <key>en-us</key>
       <text>english</text>
</name>

Error report:
ORA-06550: line 4, column 13:
PL/SQL: ORA-00932: inconsistent datatypes: expected - got CHAR
ORA-06550: line 4, column 5:
PL/SQL: SQL Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:



declare 
   v_name xmltype;
begin 
    select :name into v_name from dual;
end;

Can anyone help me in how to pass the value for :name value in enter bind tab in sqldeveloper?

CodePudding user response:

You are passing in a string value, so you need to convert that to XMLType explicitly:

select xmltype(:name) into v_name from dual;

Or assign it without the SQL context switch:

v_name := xmltype(:name);
  • Related