普通用户查看Oracle参数的值
create or replace function get_param(p_name in varchar2)
return varchar2
as
l_param_type number;
l_intval binary_integer;
l_strval varchar2(256);
invalid_parameter exception;
pragma exception_init(invalid_parameter,-20000);
begin
begin
l_param_type := dbms_utility.get_parameter_value(parnam => p_name,intval => l_intval,strval => l_strval);
exception
when invalid_parameter then
return '*access denied*';
end;
if(l_param_type = 0) then
l_strval := to_char(l_intval);
end if;
return l_strval;
end get_param;
/
SQL> conn scott/tiger
已连接。
SQL> create or replace function get_param(p_name in varchar2)
2 return varchar2
3 as
4 l_param_type number;
5 l_intval binary_integer;
6 l_strval varchar2(256);
7 invalid_parameter exception;
8 pragma exception_init(invalid_parameter,-20000);
9 begin
10 begin
11 l_param_type := dbms_utility.get_parameter_value(parnam => p_name,intval => l_intval,strval => l_strval);
12 exception
13 when invalid_parameter
14 then
15 return '*access denied*';
16 end;
17 if(l_param_type = 0)
18 then
19 l_strval := to_char(l_intval);
20 end if;
21 return l_strval;
22 end get_param;
23 /
函数已创建。
SQL> set serveroutput on;
SQL> exec dbms_output.put_line(get_param('db_block_size'));
8192