Oracle自定义函数查询数据字典项
/******************************
假设存储数据字典表名:data_dict_entry
表结构如下:
create table data_dict_entry
(
DICTTYPEID VARCHAR2(128) not null,
DICTID VARCHAR2(128) not null,
DICTNAME VARCHAR2(255),
STATUS NUMBER(10),
SORTNO NUMBER(10),
RANK NUMBER(10),
PARENTID VARCHAR2(255),
SEQNO VARCHAR2(255),
FILTER1 VARCHAR2(255),
FILTER2 VARCHAR2(255)
)
/******************************/
create or replace function QUERY_DICT_SEXCODE(code_value in varchar2) return varchar2
is Result varchar2(50);
/************开始******************/
mid_vlaue varchar2(50);
begin
select t.dictname into mid_vlaue from data_dict_entry t where t.dicttypeid='type_Id' and t.dictid=code_value;
Result:=mid_vlaue ;
return(Result);
end QUERY_DICT_SEXCODE;