但是,我觉的还不够,能够做到每个连接建立的时候,就自动完成这种映射,令人高兴的是,oracle 8i提供了系统级的触发器,让我轻松地实现。
|
--scott用户登陆触发器 connect system/manager@oracle create or replace trigger scott.tg_set_usr_context after logon on database begin secusr.customer_security_context.set_customerid; end; --断掉connection,重新登陆 oracle8i enterprise edition release 8.1.7.0.0 - production with the partitioning option jserver release 8.1.7.0.0 - production sql> connect scott/tiger@oracle 已连接。 sql> select sys_context('customer_context','customerid') from dual; sys_context('customer_context','customerid') -------------------------------------------------------------------------------- alfki sql> |