Sql 如何将函数结果分配给SELECT的WITH子句中的名称?
如何将函数结果分配给WITH子句中的名称 尝试:Sql 如何将函数结果分配给SELECT的WITH子句中的名称?,sql,oracle,select,oracle19c,with-clause,Sql,Oracle,Select,Oracle19c,With Clause,如何将函数结果分配给WITH子句中的名称 尝试: 与 has_perm as(has_perm(:user)) 从my_表中选择*,其中的_perm='Y' 这就是你想要的吗 with has_perm as ( select has_perm(:user) as has_perm from dual ) select * from my_table where 'Y' = (select has_perm from has_perm); 为什么不在没有CTE
与
has_perm as(has_perm(:user))
从my_表中选择*,其中的_perm='Y'
这就是你想要的吗
with has_perm as (
select has_perm(:user) as has_perm
from dual
)
select *
from my_table
where 'Y' = (select has_perm from has_perm);
为什么不在没有CTE的情况下写呢
select *
from my_table
where has_perm(:user) = 'Y';
我不知道您所说的“在WITH子句中将函数结果分配给名称”是什么意思。你的意思是定义一个内联函数,例如,
with function has_perm(params)return number
,比如?是的,这就是我想要的,尽管有更好的语法来实现这一点。回答你的问题,因为在我的例子中,有很多参数。