Hello! I'm trying to use the code in a View in order to return the sum of amount in a column. However, I want to do a JOIN so that I can pass a parameter from the main query to the subquery as follows.
- create view
- view_test
- as
- select
- a.column1,
- a.column2,
-
- (select sum(amtval)
- from example,
- xmltable(
- 'for $r in /row
- for $c2 in $r/c2
- let $m2 := $c2/@m
- let $c5 := $r/c5[@m=$m2]
- where exists($c5)
- return <amt> {$c2} {$c5} </amt>'
- passing yourdata
- columns
- amount varchar2(10) path 'c2',
- amtval number(10,2) path 'number(c5)'
- )
- where amount = a.column2),
-
- a.column3
- from
- test_table a;
I am getting invalid identifier error when trying to do so (where amount = a.column2). How do I modify the query so that I can do the join on the other table?