我想知道在 PLSQL 中使用嵌套函数的正确方法。在下面的代码片段中,函数“to_number”工作正常,但我的两个嵌套函数不能以相同的方式使用。
Declare
Tettt Number;
Function lolazo(pigt Number, p_Fecha_Fact Date)
Return Number Is
resultado number;
Begin
Select Vp.Valor
into resultado
from valor_precio vp
Where Vp.Id_Tipo_Cargo = 103
And Vp.Id_Grupo_Precio = pigt
and vp.f_inicio_precio =
(select max(vp2.f_inicio_precio)
From Valor_Precio Vp2
Where Vp2.Id_Grupo_Precio = pigt
And Vp2.F_Inicio_Precio < p_fecha_fact
And Vp2.Id_Tipo_Cargo = 103 );
Return Resultado;
End Lolazo;
Function Multi(Uno Number, Dos Number) Return Number Is
Begin
return uno*dos;
End Multi;
Begin
Select to_number('123')
Into Tettt
From Dual;
-- Doesn't work!
-- Select lolazo(1544, to_date('01/01/2011','dd/mm/yyyy'))
-- Into Tettt
-- From Dual;
-- Doesn't work!
-- select Multi(2,3) into Tettt from dual;
Dbms_Output.Put_Line(lolazo(1544, to_date('01/01/2011','dd/mm/yyyy')));
Dbms_Output.Put_Line(Multi(2,3));
dbms_output.put_line(Tettt);
end;