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!

PL/SQL Cursor function call in where clause

User_W65WSOct 3 2019 — edited Oct 3 2019

Hi All,

When I declare cursor with function call in the where clause, upon execution, it gives me following error:

ORA-00904: "GET_ORDER_TYPE": invalid identifier

CURSOR price_cur (p_header_id         NUMBER

                          ) IS

SELECT

         ooh.order_number

       , ool.line_number

       , ooh.header_id

       , ool.line_id  

  FROM   oe_order_headers_all   ooh  

       , oe_order_lines_all     ool

       , oe_price_adjustments_v opa

  WHERE

         1  = 1

   AND ooh.header_id = p_header_id

   AND ooh.header_id = ool.header_id

   AND ooh.header_id = opa.header_id

   AND ool.line_id = opa.line_id 

  AND get_order_type(ooh.order_type_id) = 1      ---  get_order_type is a function

If I remove the line get_order_type(ooh.order_type_id) = 1 , it runs fine.  get_order_type is a function inside the same package.

Let me know whether we can call function  in WHERE CLAUSE OR NOT?

Thanks

This post has been answered by John Thorton on Oct 3 2019
Jump to Answer
Comments
Post Details
Added on Oct 3 2019
4 comments
1,255 views