数据仓库服务 GAUSSDB(DWS)-PL/SQL:ALTER SESSION

时间:2024-12-10 11:28:52

ALTER SESSION

Oracle中的ALTER SESSION语句用于设置或修改数据库连接的参数和行为。该语句将持续有效,除非数据库连接断开。DSC可迁移如下形式的ALTER SESSION语句:

  • 含有ADVISE、ENABLE、DISABLE、CLOSE和FORCE的ALTER SESSION语句将被迁移为注释脚本。
  • 含有SET CLAUSE参数(例如:NLS_DATE_FORMAT和NLS_DATE_LANGUAGE等)的ALTER SESSION语句将被逐字复制。

该工具不支持迁移命令子句含有变量的ALTER SESSION语句。

例如:EXECUTE IMMEDIATE ' alter session ' || command_val || 'parallel ' || type_value.

示例中,command_val是变量,不受DSC支持。不支持的语句将被逐字复制到已迁移的脚本中。

输入:ALTER SESSION

1
2
3
4
5
ALTER SESSION ENABLE  PARALLEL DDL;
ALTER SESSION  ADVISE COMMIT;
ALTER SESSION CLOSE DATABASE LINK local;
ALTER SESSION  SET NLS_DATE_FORMAT = 'YYYY MM DD HH24:MI:SS';
ALTER SESSION SET current_schema = 'isfc';

输出

1
2
3
4
5
/*ALTER SESSION ENABLE PARALLEL DDL;*/
/*ALTER SESSION ADVISE COMMIT;*/
/*ALTER SESSION CLOSE DATABASE LINK local;*/
ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY MM DD HH24:MI:SS';
ALTER SESSION SET current_schema = 'isfc';

输入:ALTER SESSION

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
CREATE OR REPLACE
     PROCEDURE PUBLIC .TEST_CALL is
    command_val varchar2 ( 1000 ) ;
     type_value number ;
    BEGIN
                command_val := 'enable parallel ddl' ;
                dbms_output.put_line ( mike ) ;
-- execute immediate 'ALTER SESSION DISABLE GUARD' ;
               execute immediate 'ALTER SESSION ADVISE ROLLBACK' ;
EXECUTE IMMEDIATE ' alter session ' || command_val || 'parallel ' || type_value ;
END TEST_CALL;
/
                                      

输出

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
CREATE OR REPLACE
     PROCEDURE PUBLIC.TEST_CALL is 
     command_val varchar2 ( 1000 ) ;
     type_value number ;
     BEGIN
                 command_val := 'enable parallel ddl' ;
dbms_output.put_line ( mike ) ;
/*  execute immediate 'ALTER SESSION DISABLE GUARD' ; */
               execute immediate '/*ALTER SESSION ADVISE ROLLBACK*/' ;
EXECUTE IMMEDIATE 'alter session ' || command_val || 'parallel ' || type_value ;
  END ;
  /
support.huaweicloud.com/tg-dws/dws_mt_0141.html