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!

XMLTable - passing in dynamic variables

625090Feb 25 2008 — edited Apr 14 2008
Hi,

I am using XMLTable to shred XML data stored in external files into a virtual table so it can be imported into Oracle 10g. I am having problems trying to pass a dynamic file path parameter into the XMLTable function. E.g.

DECLARE

xml_file_name varchar2(50):= '/public/user.xml'; --currently hardcoded in example - will be dynamically built

cursor c2 is
select * from XMLTable('for $i in doc($XMLPATH) return $i/ROWSET/ROW'
passing xml_file_name as "XMLPATH"
columns ID INTEGER PATH 'ID',
USERNAME VARCHAR2(255) PATH 'USERNAME');

BEGIN
--do the import here

END;


The error I get is:
PL/SQL: ORA-00932: inconsistent datatypes: expected - got CHAR


Is this correct use of the "passing" parameter? If not, is there any other way to pass in a dynamically xml file path?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2008
Added on Feb 25 2008
3 comments
2,669 views