Sfoglia il codice sorgente

update 调整sql执行顺序

疯狂的狮子Li 1 anno fa
parent
commit
2674a0cda2

+ 11 - 12
script/sql/oracle/oracle_ry_cloud.sql

@@ -1405,18 +1405,6 @@ insert into test_tree values (11, '000000', 7, 108, 3, '子节点77', 0, 103, sy
 insert into test_tree values (12, '000000', 10, 108, 3, '子节点88', 0, 103, sysdate, 1, null, null, 0);
 insert into test_tree values (13, '000000', 10, 108, 3, '子节点99', 0, 103, sysdate, 1, null, null, 0);
 
-
--- ----------------------------
--- 钩子 ,用于session连接之后 自动设置默认的date类型格式化 简化时间查询
--- 如需设置其它配置 可在此钩子内任意增加处理语句
--- 例如: SELECT * FROM sys_user WHERE create_time BETWEEN '2022-03-01 00:00:00' AND '2022-04-01 00:00:00'
--- ----------------------------
-create or replace trigger login_trg
-after logon on database
-begin
-execute immediate 'alter session set nls_date_format=''YYYY-MM-DD HH24:MI:SS''';
-end;
-
 -- for AT mode you must to init this sql for you business database. the seata server not need it.
 CREATE TABLE undo_log
 (
@@ -1443,3 +1431,14 @@ COMMENT ON COLUMN undo_log.log_modified is 'modify datetime';
 
 -- Generate ID using sequence and trigger
 CREATE SEQUENCE UNDO_LOG_SEQ START WITH 1 INCREMENT BY 1;
+
+-- ----------------------------
+-- 钩子 ,用于session连接之后 自动设置默认的date类型格式化 简化时间查询
+-- 如需设置其它配置 可在此钩子内任意增加处理语句
+-- 例如: SELECT * FROM sys_user WHERE create_time BETWEEN '2022-03-01 00:00:00' AND '2022-04-01 00:00:00'
+-- ----------------------------
+create or replace trigger login_trg
+after logon on database
+begin
+execute immediate 'alter session set nls_date_format=''YYYY-MM-DD HH24:MI:SS''';
+end;

+ 8 - 9
script/sql/postgres/postgres_ry_cloud.sql

@@ -1398,15 +1398,6 @@ insert into test_tree values (11, '000000', 7, 108, 3, '子节点77', 0, 103, no
 insert into test_tree values (12, '000000', 10, 108, 3, '子节点88', 0, 103, now(), 1, NULL, NULL, 0);
 insert into test_tree values (13, '000000', 10, 108, 3, '子节点99', 0, 103, now(), 1, NULL, NULL, 0);
 
-
--- 字符串自动转时间 避免框架时间查询报错问题
-create or replace function cast_varchar_to_timestamp(varchar) returns timestamptz as $$
-select to_timestamp($1, 'yyyy-mm-dd hh24:mi:ss');
-$$ language sql strict ;
-
-create cast (varchar as timestamptz) with function cast_varchar_to_timestamp as IMPLICIT;
-
-
 -- for AT mode you must to init this sql for you business database. the seata server not need it.
 CREATE TABLE IF NOT EXISTS public.undo_log
 (
@@ -1433,3 +1424,11 @@ COMMENT ON COLUMN public.undo_log.log_created IS 'create datetime';
 COMMENT ON COLUMN public.undo_log.log_modified IS 'modify datetime';
 
 CREATE SEQUENCE IF NOT EXISTS undo_log_id_seq INCREMENT BY 1 MINVALUE 1 ;
+
+
+-- 字符串自动转时间 避免框架时间查询报错问题
+create or replace function cast_varchar_to_timestamp(varchar) returns timestamptz as $$
+select to_timestamp($1, 'yyyy-mm-dd hh24:mi:ss');
+$$ language sql strict ;
+
+create cast (varchar as timestamptz) with function cast_varchar_to_timestamp as IMPLICIT;