如何在单个查询中定义多个(WITH AS FUNCTIONS)?
how to define multiple (WITH AS FUNCTIONS) in a single query?
试图在单个 with 子句下定义多个函数。我们通常为 CTE 所做的。但对于功能来说,同样是行不通的。请提出解决方案。
With function dt ( b as number)
return number is
n number ;
begin
select 1 into n;
return n ;
end ;
dt2 ( c as number)
return number is
n1 number ;
begin
select 1 into n;
return n1;
end ;
select dt(1) , dt2(1) from dual
仅使用 dt 时,我可以获得 o/p 但不能使用 dt2。
正在使用以下示例:
with
function x(p_NUM in number) return number
is
n number;
begin
SELECT 1 INTO N FROM DUAL;
--
return N;
--
end ;
--
function Y(p_NUM in number) return number
is
N1 NUMBER;
begin
SELECT 2 INTO N1 FROM DUAL;
--
return N1;
--
end ;
--
select X(1), Y(1)
from dual;
干杯!!
试图在单个 with 子句下定义多个函数。我们通常为 CTE 所做的。但对于功能来说,同样是行不通的。请提出解决方案。
With function dt ( b as number)
return number is
n number ;
begin
select 1 into n;
return n ;
end ;
dt2 ( c as number)
return number is
n1 number ;
begin
select 1 into n;
return n1;
end ;
select dt(1) , dt2(1) from dual
仅使用 dt 时,我可以获得 o/p 但不能使用 dt2。
正在使用以下示例:
with
function x(p_NUM in number) return number
is
n number;
begin
SELECT 1 INTO N FROM DUAL;
--
return N;
--
end ;
--
function Y(p_NUM in number) return number
is
N1 NUMBER;
begin
SELECT 2 INTO N1 FROM DUAL;
--
return N1;
--
end ;
--
select X(1), Y(1)
from dual;
干杯!!