Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 62 Insurance
- 536.1K On-Premises Infrastructure
- 138.2K Analytics Software
- 38.6K Application Development Software
- 5.7K Cloud Platform
- 109.4K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.2K Integration
- 41.6K Security Software
Xquery External Variable Binding
Hi everyone...
Can anyone throw some light on external variable binding in xquery with Oracle 11G XMLDB?
declare $foo as xs:string external;
Thanks in advance,
Regards,
Kaja
Can anyone throw some light on external variable binding in xquery with Oracle 11G XMLDB?
declare $foo as xs:string external;
Thanks in advance,
Regards,
Kaja
Tagged:
Best Answer
-
you can use passing clause like in xmltable for example
SQL> with t as (select xmltype('<a><b>1</b><b>2</b></a>') xcol from dual) 2 select x.* 3 from t 4 ,xmltable('for $i in $AA/a/b where $i=$bind_val return $i' 5 passing t.xcol as "AA" 6 ,2 as "bind_val" 7 columns val number path '.') x; VAL ---------- 2
Answers
-
you can use passing clause like in xmltable for example
SQL> with t as (select xmltype('<a><b>1</b><b>2</b></a>') xcol from dual) 2 select x.* 3 from t 4 ,xmltable('for $i in $AA/a/b where $i=$bind_val return $i' 5 passing t.xcol as "AA" 6 ,2 as "bind_val" 7 columns val number path '.') x; VAL ---------- 2
-
Hi Ants.
Is there an alternative for ora:view while using an xmltype table for source...(see: 721761
Sorry for the interruption ;-)
Edited by: Marco Gralike on Oct 24, 2008 9:31 PM -
Hi Marco,
besides those possibilities in here 721761
it's also possible to use doc(:uriType)
btw, there's a shorter version of ora:view()SQL> select * from 2 xmltable('ora:view("XTAB")/site/people/person[@id="person0"]/name/text()'); COLUMN_VALUE -------------------------------------------------------------------------------- Jaak Tempesti SQL> spool off;
Ants -
Thanks Ants
good suggestion
I though that doc(:uriType) could't be used for tables (I will check it) ? -
I though that doc(:uriType) could't be used for tables (I will check it) ?my bad, I forgot that your data is in a table.
You can use doc() only if it's created with dbms_xdb.createresource
This discussion has been closed.