Hello..
someone could help me... I am trying to do a dinamic query byt always fails when I call the function
create or replace function f_consulta_val_dominio(par_dominio varchar2,par_valor varchar2,par_Abreviatura varchar2)
return varchar2
is
Descripcion varchar2(255);
sQuery varchar2(5000);
Begin
Begin
if par_Abreviatura='N' then
sQuery:='Select initcap(substr(rv_meaning,1,255))';
elsif par_Abreviatura='S' then
sQuery:='Select initcap(substr(RV_HIGH_VALUE,1,255))' ;
end if;
sQuery:=sQuery || ' From com_ref_codes Where rv_domain=:' || par_dominio || ' And rv_low_value=:' || par_valor;
EXECUTE IMMEDIATE sQuery into Descripcion;
Exception when no_data_found Then
Descripcion:=null;
When others then
raise_application_error(30501,'Error en la funcion F_CONSULTA_VAL_DOMINIO '||SQLERRM);
End;
return Descripcion;
End;
SELECT f_consulta_val_dominio ('UNIDADES MEDIDA','1','S')AS Medida FROM DUAL
someone could help me... I am trying to do a dinamic query byt always fails when I call the function
create or replace function f_consulta_val_dominio(par_dominio varchar2,par_valor varchar2,par_Abreviatura varchar2)
return varchar2
is
Descripcion varchar2(255);
sQuery varchar2(5000);
Begin
Begin
if par_Abreviatura='N' then
sQuery:='Select initcap(substr(rv_meaning,1,255))';
elsif par_Abreviatura='S' then
sQuery:='Select initcap(substr(RV_HIGH_VALUE,1,255))' ;
end if;
sQuery:=sQuery || ' From com_ref_codes Where rv_domain=:' || par_dominio || ' And rv_low_value=:' || par_valor;
EXECUTE IMMEDIATE sQuery into Descripcion;
Exception when no_data_found Then
Descripcion:=null;
When others then
raise_application_error(30501,'Error en la funcion F_CONSULTA_VAL_DOMINIO '||SQLERRM);
End;
return Descripcion;
End;
SELECT f_consulta_val_dominio ('UNIDADES MEDIDA','1','S')AS Medida FROM DUAL