v$session中command欄位的含義解析

llnnmc發表於2018-01-09

以下函式解析檢視v$session中command欄位的含義
create or replace function lln_session_cmd_info(p_cmd in number default 0)

    return varchar2 is

    v_retinfo varchar2(64);

begin

    select case p_cmd

               when 0 then

                '0'

               when 1 then

                'CREATE TABLE'

               when 2 then

                'INSERT'

               when 3 then

                'SELECT'

               when 4 then

                'CREATE CLUSTER'

               when 5 then

                'ALTER CLUSTER'

               when 6 then

                'UPDATE'

               when 7 then

                'DELETE'

               when 8 then

                'DROP CLUSTER'

               when 9 then

                'CREATE INDEX'

               when 10 then

                'DROP INDEX'

               when 11 then

                'ALTER INDEX'

               when 12 then

                'DROP TABLE'

               when 13 then

                'CREATE SEQUENCE'

               when 14 then

                'ALTER SEQUENCE'

               when 15 then

                'ALTER TABLE'

               when 16 then

                'DROP SEQUENCE'

               when 17 then

                'GRANT OBJECT'

               when 18 then

                'REVOKE OBJECT'

               when 19 then

                'CREATE SYNONYM'

               when 20 then

                'DROP SYNONYM'

               when 21 then

                'CREATE VIEW'

               when 22 then

                'DROP VIEW'

               when 23 then

                'VALIDATE INDEX'

               when 24 then

                'CREATE PROCEDURE'

               when 25 then

                'ALTER PROCEDURE'

               when 26 then

                'LOCK'

               when 27 then

                'NO-OP'

               when 28 then

                'RENAME'

               when 29 then

                'COMMENT'

               when 30 then

                'AUDIT OBJECT'

               when 31 then

                'NOAUDIT OBJECT'

               when 32 then

                'CREATE DATABASE LINK'

               when 33 then

                'DROP DATABASE LINK'

               when 34 then

                'CREATE DATABASE'

               when 35 then

                'ALTER DATABASE'

               when 36 then

                'CREATE ROLLBACK SEG'

               when 37 then

                'ALTER ROLLBACK SEG'

               when 38 then

                'DROP ROLLBACK SEG'

               when 39 then

                'CREATE TABLESPACE'

               when 40 then

                'ALTER TABLESPACE'

               when 41 then

                'DROP TABLESPACE'

               when 42 then

                'ALTER SESSION'

               when 43 then

                'ALTER USER'

               when 44 then

                'COMMIT'

               when 45 then

                'ROLLBACK'

               when 46 then

                'SAVEPOINT'

               when 47 then

                'PL/SQL EXECUTE'

               when 48 then

                'SET TRANSACTION'

               when 49 then

                'ALTER SYSTEM'

               when 50 then

                'EXPLAIN'

               when 51 then

                'CREATE USER'

               when 52 then

                'CREATE ROLE'

               when 53 then

                'DROP USER'

               when 54 then

                'DROP ROLE'

               when 55 then

                'SET ROLE'

               when 56 then

                'CREATE SCHEMA'

               when 57 then

                'CREATE CONTROL FILE'

               when 59 then

                'CREATE TRIGGER'

               when 60 then

                'ALTER TRIGGER'

               when 61 then

                'DROP TRIGGER'

               when 62 then

                'ANALYZE TABLE'

               when 63 then

                'ANALYZE INDEX'

               when 64 then

                'ANALYZE CLUSTER'

               when 65 then

                'CREATE PROFILE'

               when 66 then

                'DROP PROFILE'

               when 67 then

                'ALTER PROFILE'

               when 68 then

                'DROP PROCEDURE'

               when 70 then

                'ALTER RESOURCE COST'

               when 71 then

                'CREATE SNAPSHOT LOG'

               when 72 then

                'ALTER SNAPSHOT LOG'

               when 73 then

                'DROP SNAPSHOT LOG'

               when 74 then

                'CREATE SNAPSHOT'

               when 75 then

                'ALTER SNAPSHOT'

               when 76 then

                'DROP SNAPSHOT'

               when 77 then

                'CREATE TYPE'

               when 78 then

                'DROP TYPE'

               when 79 then

                'ALTER ROLE'

               when 80 then

                'ALTER TYPE'

               when 81 then

                'CREATE TYPE BODY'

               when 82 then

                'ALTER TYPE BODY'

               when 83 then

                'DROP TYPE BODY'

               when 84 then

                'DROP LIBRARY'

               when 85 then

                'TRUNCATE TABLE'

               when 86 then

                'TRUNCATE CLUSTER'

               when 91 then

                'CREATE FUNCTION'

               when 92 then

                'ALTER FUNCTION'

               when 93 then

                'DROP FUNCTION'

               when 94 then

                'CREATE PACKAGE'

               when 95 then

                'ALTER PACKAGE'

               when 96 then

                'DROP PACKAGE'

               when 97 then

                'CREATE PACKAGE BODY'

               when 98 then

                'ALTER PACKAGE BODY'

               when 99 then

                'DROP PACKAGE BODY'

               when 100 then

                'LOGON'

               when 101 then

                'LOGOFF'

               when 102 then

                'LOGOFF BY CLEANUP'

               when 103 then

                'SESSION REC'

               when 104 then

                'SYSTEM AUDIT'

               when 105 then

                'SYSTEM NOAUDIT'

               when 106 then

                'AUDIT DEFAULT'

               when 107 then

                'NOAUDIT DEFAULT'

               when 108 then

                'SYSTEM GRANT'

               when 109 then

                'SYSTEM REVOKE'

               when 110 then

                'CREATE PUBLIC SYNONYM'

               when 111 then

                'DROP PUBLIC SYNONYM'

               when 112 then

                'CREATE PUBLIC DATABASE LINK'

               when 113 then

                'DROP PUBLIC DATABASE LINK'

               when 114 then

                'GRANT ROLE'

               when 115 then

                'REVOKE ROLE'

               when 116 then

                'EXECUTE PROCEDURE'

               when 117 then

                'USER COMMENT'

               when 118 then

                'ENABLE TRIGGER'

               when 119 then

                'DISABLE TRIGGER'

               when 120 then

                'ENABLE ALL TRIGGERS'

               when 121 then

                'DISABLE ALL TRIGGERS'

               when 122 then

                'NETWORK ERROR'

               when 123 then

                'EXECUTE TYPE'

               when 157 then

                'CREATE DIRECTORY'

               when 158 then

                'DROP DIRECTORY'

               when 159 then

                'CREATE LIBRARY'

               when 160 then

                'CREATE JAVA'

               when 161 then

                'ALTER JAVA'

               when 162 then

                'DROP JAVA'

               when 163 then

                'CREATE OPERATOR'

               when 164 then

                'CREATE INDEXTYPE'

               when 165 then

                'DROP INDEXTYPE'

               when 167 then

                'DROP OPERATOR'

               when 168 then

                'ASSOCIATE STATISTICS'

               when 169 then

                'DISASSOCIATE STATISTICS'

               when 170 then

                'CALL METHOD'

               when 171 then

                'CREATE SUMMARY'

               when 172 then

                'ALTER SUMMARY'

               when 173 then

                'DROP SUMMARY'

               when 174 then

                'CREATE DIMENSION'

               when 175 then

                'ALTER DIMENSION'

               when 176 then

                'DROP DIMENSION'

               when 177 then

                'CREATE CONTEXT'

               when 178 then

                'DROP CONTEXT'

               when 179 then

                'ALTER OUTLINE'

               when 180 then

                'CREATE OUTLINE'

               when 181 then

                'DROP OUTLINE'

               when 182 then

                'UPDATE INDEXES'

               when 183 then

                'ALTER OPERATOR'

               else

                'This function Not Supported'

           end

      into v_retinfo

      from dual;

    return v_retinfo;

end;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28974745/viewspace-2149903/,如需轉載,請註明出處,否則將追究法律責任。

相關文章