zoukankan      html  css  js  c++  java
  • 如何切换用户到不同用户Session上

    CREATE OR REPLACE PACKAGE BODY TMS.SESSION_TMS
    AS
       PROCEDURE SESSION_TMS (STATUS VARCHAR2)
       IS
          tmpVar           VARCHAR2 (3);
          present_schema   VARCHAR2 (10);
          present_user     VARCHAR2 (10);
          mesg             VARCHAR2 (300);
      BEGIN
          tmpVar := 'OFF';
          present_schema := '';
          present_user := '';
          mesg := '';

          IF SYS_CONTEXT ('USERENV', 'SESSION_USER') = 'TMS_GUEST'
             AND upper(STATUS) = 'ON'
          THEN
             EXECUTE IMMEDIATE ('ALTER SESSION SET CURRENT_SCHEMA=TMS');

             PRESENT_SCHEMA := 'TMS';
             PRESENT_USER := 'TMS_GUEST';
          END IF;
          IF SYS_CONTEXT ('USERENV', 'SESSION_USER') = 'TMS_GUEST'
             AND upper(STATUS) = 'OFF'
          THEN
             EXECUTE IMMEDIATE ('ALTER SESSION SET CURRENT_SCHEMA=TMS_GUEST');

             PRESENT_SCHEMA := 'TMS_GUEST';
             PRESENT_USER := 'TMS_GUEST';
          END IF;

          mesg := ' Your present schema ' || present_schema;
          mesg := mesg || '  User session is ' || present_user;
          DBMS_OUTPUT.put_line (mesg);
       END;
    --SELECT   SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA'),
    --             SYS_CONTEXT ('USERENV', 'session_user')
    --    INTO   present_schema, present_user
    --  FROM   DUAL;
    END SESSION_TMS;
    /

  • 相关阅读:
    CentOS7修改网卡为eth0
    前端开发实时可视化
    push本地代码到github发生错误的解决办法
    前端面试总结(一)
    HTML5+CSS3开发移动端页面
    web安全-XSS
    前端面试总结
    JavaScript中的原型和原型链
    jQuery与Ajax
    JavaScript中模块化工具require.js
  • 原文地址:https://www.cnblogs.com/tracy/p/2067688.html
Copyright © 2011-2022 走看看