How to use a package constant in SQL SELECT statement?

后端 未结 4 712
难免孤独
难免孤独 2020-12-04 23:53

How can I use a package variable in a simple SELECT query statement in Oracle?

Something like

SELECT * FROM MyTable WHERE TypeId = MyPackage.MY_TYPE
         


        
4条回答
  •  忘掉有多难
    2020-12-05 00:11

    No, you aren'e allowed to do that. You would need to provide a function that returns the value and then use that in the SQL:

    SELECT * FROM MyTable WHERE TypeId = MyPackage.FUN_MY_TYPE
    

提交回复
热议问题