1.建立登陸判斷函數 create or replace function fun_log_check ( var_user_name in varchar2 ) return number as result number(10) ; begin /* --根據帳號(用戶)來判斷權限; ................ result := 0 ; */return result ; end; / 2.create or replace procedure pro_grant_priv ( var_user_name in varchar2 ) as is_right number(10); begin is_right := fun_login_check(var_user_name); if is_right = 1 then execute immediate 'grant ....';
end if ; if is_right = 0 then
return ;
end ;end; / 3.. exec pro_grant_priv('xxx');
呵呵,又是包子,那边的问题先谢谢你问一下,如果许多条GRANT语句,是不是一条写一个IF?
............. if is_right = 1 then execute immediate 'grant ....'; execute immediate 'grant ....'; execute immediate ...........
实在没办法了....
大家帮忙想个办法看看,能不能通过SQL语句执实现应该是通过存储过程实现ORACLE自动授权,不必一条一条执行GRANT语句了...有谁有这方面的例子也可以帖来参考参考..先谢过了!
create or replace function fun_log_check
(
var_user_name in varchar2
)
return number
as
result number(10) ;
begin
/*
--根據帳號(用戶)來判斷權限;
................
result := 0 ;
*/return result ;
end;
/
2.create or replace procedure pro_grant_priv
(
var_user_name in varchar2
)
as
is_right number(10);
begin
is_right := fun_login_check(var_user_name); if is_right = 1 then execute immediate 'grant ....';
end if ; if is_right = 0 then
return ;
end ;end;
/
3..
exec pro_grant_priv('xxx');
if is_right = 1 then execute immediate 'grant ....'; execute immediate 'grant ....'; execute immediate ...........
end if ;
end if ;