Skip to Main Content

DevOps, CI/CD and Automation

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!

Invalid identifier in SQL query

3679117Apr 11 2018 — edited Apr 17 2018

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.

  1. create view 
  2.     view_test 
  3. as 
  4. select 
  5. a.column1, 
  6. a.column2, 
  7.  
  8. (select sum(amtval) 
  9. from example, 
  10.     xmltable( 
  11.         'for $r in /row 
  12.             for $c2 in $r/c2 
  13.                 let $m2 := $c2/@m 
  14.                 let $c5 := $r/c5[@m=$m2] 
  15.                 where exists($c5) 
  16.                     return <amt> {$c2} {$c5} </amt>' 
  17.     passing yourdata 
  18.     columns  
  19.         amount varchar2(10) path 'c2', 
  20.         amtval number(10,2) path 'number(c5)' 
  21.     ) 
  22. where amount = a.column2), 
  23.  
  24. a.column3 
  25. from 
  26. 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?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2018
Added on Apr 11 2018
3 comments
1,630 views