sql tuning advisor

通过Oracle自带的sql调优助手进行sql调优

下面演示通过sql_id生成调优建议:

--开始创建调优任务
DECLARE
my_task_name VARCHAR2(30);
BEGIN
my_task_name := DBMS_SQLTUNE.CREATE_TUNING_TASK(
SQL_ID => '12qm4ffkbwg1p',   --要调优的sql_id
scope => 'COMPREHENSIVE',
time_limit => 100,
task_name => 'tunning_task',   --任务名称,随便取
description => 'Task to tune a query on 12qm4ffkbwg1p');   --描述,随便写
DBMS_SQLTUNE.EXECUTE_TUNING_TASK( task_name => 'tunning_task' );    --执行调优任务
END;

--查看用户下有哪些调优任务

SELECT TASK_NAME FROM DBA_ADVISOR_LOG WHERE OWNER = 'PORTAL56_HIS';

--查看调优建议
 select DBMS_SQLTUNE.REPORT_TUNING_TASK('tunning_task') from dual;
 
 --删除调优任务 
exec dbms_sqltune.drop_tuning_task('tunning_task');
    

获取sql_id的方法:

1.通过v$sqlarea用sql_text查找

2.先执行要调优的sql,查看数据库中正在执行的sql和sql_id

SELECT b.sid oracleID, 
       b.username, 
       b.serial#, 
       a.spid , 
       b.machine ,
       b.program, 
       c.sql_text  
FROM v$process a, v$session b, v$sqlarea c 
WHERE a.addr = b.paddr AND b.status='ACTIVE'
   AND b.sql_id= c.sql_id;  

执行
select DBMS_SQLTUNE.REPORT_TUNING_TASK(‘tunning_task’) from dual;
可以查看生成的调优建议
在这里插入图片描述
下面是clob中的具体内容

GENERAL INFORMATION SECTION
-------------------------------------------------------------------------------
Tuning Task Name   : tunning_task
Tuning Task Owner  : PORTAL56_HIS
Workload Type      : Single SQL Statement
Scope              : COMPREHENSIVE
Time Limit(seconds): 100
Completion Status  : COMPLETED
Started at         : 07/30/2024 21:20:06
Completed at       : 07/30/2024 21:21:20

-------------------------------------------------------------------------------
Schema Name: PORTAL56_HIS
SQL ID     : 12qm4ffkbwg1p
SQL Text   : select t1.*
               from emr_inspection_document_syxy t1
             where
             UPDATE_TIME between to_date('2024-04-01 00:00:00','yyyy-mm-dd
             hh24:mi:ss') and to_date('2024-07-30 23:59:59','yyyy-mm-dd
             hh24:mi:ss')
             --and rpt_no='50867891'
             and exists (select t2.* from emr_inspection_info_syxy t2
             where
             t1.rpt_no=t2.rpt_no
             and
             t2.ris_study_id ='GE2378521')

-------------------------------------------------------------------------------
FINDINGS SECTION (1 finding)
-------------------------------------------------------------------------------

1- SQL Profile Finding (see explain plans section below)
--------------------------------------------------------
  为此语句找到了性能更好的执行计划。

  Recommendation (estimated benefit: 98.1%)
  -----------------------------------------
  - 考虑接受推荐的 SQL 概要文件。
    execute dbms_sqltune.accept_sql_profile(task_name => 'tunning_task',
            task_owner => 'PORTAL56_HIS', replace => TRUE);

-------------------------------------------------------------------------------
ADDITIONAL INFORMATION SECTION
-------------------------------------------------------------------------------
- 优化程序不能合并位于执行计划的行 ID 21 处的视图。. 优化程序不能合并包含设置运算符的视图。.

-------------------------------------------------------------------------------
EXPLAIN PLANS SECTION
-------------------------------------------------------------------------------

1- Original With Adjusted Cost
------------------------------
Plan hash value: 3751399867

-----------------------------------------------------------------------------------------------------------------------
| Id  | Operation                            | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                     |                                |     1 |  1178 |  5329K  (1)| 17:45:59 |
|*  1 |  FILTER                              |                                |       |       |            |          |
|   2 |   NESTED LOOPS                       |                                |     1 |  1178 |  5329K  (1)| 17:45:53 |
|   3 |    NESTED LOOPS                      |                                |     1 |    34 |  5301K  (1)| 17:40:13 |
|   4 |     VIEW                             |                                |   112K|  3071K| 17135   (1)| 00:03:26 |
|   5 |      UNION-ALL                       |                                |       |       |            |          |
|*  6 |       TABLE ACCESS FULL              | ZQ_SAMPLING_RECORD_GE          | 90049 |  2374K| 16348   (1)| 00:03:17 |
|*  7 |       TABLE ACCESS FULL              | ZQ_SAMPLING_RECORD_LW          | 14221 |   374K|   583   (1)| 00:00:07 |
|*  8 |       TABLE ACCESS FULL              | ZQ_SAMPLING_RECORD_LB          |  8074 |   220K|   205   (1)| 00:00:03 |
|   9 |     VIEW                             | ZQ_SQDH2OPEMNO                 |     1 |     6 |    47   (0)| 00:00:01 |
|  10 |      UNION ALL PUSHED PREDICATE      |                                |       |       |            |          |
|  11 |       NESTED LOOPS                   |                                |    41 |  1025 |     4   (0)| 00:00:01 |
|* 12 |        TABLE ACCESS BY INDEX ROWID   | EMR_JCSQ                       |     1 |    17 |     3   (0)| 00:00:01 |
|* 13 |         INDEX UNIQUE SCAN            | PK_EMR_JCSQ                    |     1 |       |     2   (0)| 00:00:01 |
|* 14 |        INDEX UNIQUE SCAN             | PK_ZY_BRRY                     |     1 |       |     0   (0)| 00:00:01 |
|  15 |       NESTED LOOPS                   |                                |    38 |  1406 |    43   (0)| 00:00:01 |
|  16 |        NESTED LOOPS                  |                                |    38 |  1178 |     5   (0)| 00:00:01 |
|* 17 |         TABLE ACCESS BY INDEX ROWID  | EMR_JCSQ                       |     1 |    23 |     3   (0)| 00:00:01 |
|* 18 |          INDEX UNIQUE SCAN           | PK_EMR_JCSQ                    |     1 |       |     2   (0)| 00:00:01 |
|* 19 |         INDEX UNIQUE SCAN            | PK_MS_BRDA                     |     1 |       |     1   (0)| 00:00:01 |
|* 20 |        INDEX UNIQUE SCAN             | PK_YS_MZ_JZLS                  |     1 |     6 |     1   (0)| 00:00:01 |
|  21 |    VIEW                              | EMR_INSPECTION_DOCUMENT_RECORD |     1 |  1144 | 28333   (3)| 00:05:41 |
|  22 |     UNION ALL PUSHED PREDICATE       |                                |       |       |            |          |
|  23 |      TABLE ACCESS BY INDEX ROWID     | GY_DMZD                        |     1 |    10 |     2   (0)| 00:00:01 |
|* 24 |       INDEX UNIQUE SCAN              | PK_GY_DMZD                     |     1 |       |     1   (0)| 00:00:01 |
|  25 |      VIEW                            | V_MS_GHMX                      |     2 |    52 |     5   (0)| 00:00:01 |
|  26 |       UNION-ALL                      |                                |       |       |            |          |
|* 27 |        INDEX RANGE SCAN              | ZY3                            |     1 |     9 |     3   (0)| 00:00:01 |
|  28 |        TABLE ACCESS BY INDEX ROWID   | MS_GHMX_LS                     |     1 |     8 |     2   (0)| 00:00:01 |
|* 29 |         INDEX UNIQUE SCAN            | PK_MS_GHMX_LS                  |     1 |       |     1   (0)| 00:00:01 |
|  30 |      TABLE ACCESS BY INDEX ROWID     | EMR_DMZD                       |     1 |    10 |     2   (0)| 00:00:01 |
|* 31 |       INDEX UNIQUE SCAN              | PK_EMR_DMZD                    |     1 |       |     1   (0)| 00:00:01 |
|  32 |      TABLE ACCESS BY INDEX ROWID     | GY_KSDM                        |     1 |     9 |     1   (0)| 00:00:01 |
|* 33 |       INDEX UNIQUE SCAN              | PK_GY_KSDM                     |     1 |       |     0   (0)| 00:00:01 |
|  34 |      TABLE ACCESS BY INDEX ROWID     | GY_KSDM                        |     1 |    14 |     1   (0)| 00:00:01 |
|* 35 |       INDEX UNIQUE SCAN              | PK_GY_KSDM                     |     1 |       |     0   (0)| 00:00:01 |
|  36 |      TABLE ACCESS BY INDEX ROWID     | GY_YGDM                        |     1 |    18 |     2   (0)| 00:00:01 |
|* 37 |       INDEX UNIQUE SCAN              | PK_GY_YGDM                     |     1 |       |     1   (0)| 00:00:01 |
|  38 |      TABLE ACCESS BY INDEX ROWID     | GY_YGDM                        |     1 |    14 |     2   (0)| 00:00:01 |
|* 39 |       INDEX UNIQUE SCAN              | PK_GY_YGDM                     |     1 |       |     1   (0)| 00:00:01 |
|  40 |      NESTED LOOPS                    |                                |    69 | 19113 | 15199   (3)| 00:03:03 |
|  41 |       MERGE JOIN CARTESIAN           |                                |   537K|   139M| 15117   (2)| 00:03:02 |
|  42 |        NESTED LOOPS                  |                                |    76 | 17936 |   370   (0)| 00:00:05 |
|  43 |         NESTED LOOPS                 |                                |    73 | 15038 |   151   (0)| 00:00:02 |
|  44 |          NESTED LOOPS                |                                |    73 |  9271 |     5   (0)| 00:00:01 |
|* 45 |           TABLE ACCESS BY INDEX ROWID| EMR_JCSQ                       |     1 |    96 |     3   (0)| 00:00:01 |
|* 46 |            INDEX UNIQUE SCAN         | PK_EMR_JCSQ                    |     1 |       |     2   (0)| 00:00:01 |
|  47 |           TABLE ACCESS BY INDEX ROWID| YS_MZ_JZLS                     |    73 |  2263 |     2   (0)| 00:00:01 |
|* 48 |            INDEX UNIQUE SCAN         | PK_YS_MZ_JZLS                  |     1 |       |     1   (0)| 00:00:01 |
|  49 |          TABLE ACCESS BY INDEX ROWID | MS_BRDA                        |     1 |    79 |     2   (0)| 00:00:01 |
|* 50 |           INDEX UNIQUE SCAN          | PK_MS_BRDA                     |     1 |       |     1   (0)| 00:00:01 |
|* 51 |         TABLE ACCESS BY INDEX ROWID  | EMR_JCXM                       |     1 |    30 |     3   (0)| 00:00:01 |
|* 52 |          INDEX RANGE SCAN            | PK_EMR_JCXM                    |     1 |       |     2   (0)| 00:00:01 |
|  53 |        BUFFER SORT                   |                                |  7104 |   249K| 15114   (2)| 00:03:02 |
|* 54 |         VIEW                         |                                |  7104 |   249K|   194   (2)| 00:00:03 |
|* 55 |          WINDOW SORT PUSHED RANK     |                                |  7104 |   215K|   194   (2)| 00:00:03 |
|* 56 |           HASH JOIN                  |                                |  7104 |   215K|   193   (2)| 00:00:03 |
|* 57 |            TABLE ACCESS FULL         | EMR_ZLSFDZ                     |  7104 | 92352 |    17   (0)| 00:00:01 |
|* 58 |            TABLE ACCESS FULL         | GY_YLML                        | 16101 |   283K|   175   (1)| 00:00:03 |
|* 59 |       INDEX UNIQUE SCAN              | PK_EMR_ZLXM                    |     1 |     5 |     0   (0)| 00:00:01 |
|  60 |      TABLE ACCESS BY INDEX ROWID     | GY_DMZD                        |     1 |    10 |     2   (0)| 00:00:01 |
|* 61 |       INDEX UNIQUE SCAN              | PK_GY_DMZD                     |     1 |       |     1   (0)| 00:00:01 |
|  62 |      TABLE ACCESS BY INDEX ROWID     | EMR_DMZD                       |     1 |    10 |     2   (0)| 00:00:01 |
|* 63 |       INDEX UNIQUE SCAN              | PK_EMR_DMZD                    |     1 |       |     1   (0)| 00:00:01 |
|  64 |      TABLE ACCESS BY INDEX ROWID     | GY_KSDM                        |     1 |     9 |     1   (0)| 00:00:01 |
|* 65 |       INDEX UNIQUE SCAN              | PK_GY_KSDM                     |     1 |       |     0   (0)| 00:00:01 |
|  66 |      TABLE ACCESS BY INDEX ROWID     | GY_KSDM                        |     1 |    14 |     1   (0)| 00:00:01 |
|* 67 |       INDEX UNIQUE SCAN              | PK_GY_KSDM                     |     1 |       |     0   (0)| 00:00:01 |
|  68 |      TABLE ACCESS BY INDEX ROWID     | GY_YGDM                        |     1 |    18 |     2   (0)| 00:00:01 |
|* 69 |       INDEX UNIQUE SCAN              | PK_GY_YGDM                     |     1 |       |     1   (0)| 00:00:01 |
|  70 |      TABLE ACCESS BY INDEX ROWID     | GY_YGDM                        |     1 |    14 |     2   (0)| 00:00:01 |
|* 71 |       INDEX UNIQUE SCAN              | PK_GY_YGDM                     |     1 |       |     1   (0)| 00:00:01 |
|  72 |      TABLE ACCESS BY INDEX ROWID     | GY_KSDM                        |     1 |    14 |     1   (0)| 00:00:01 |
|* 73 |       INDEX UNIQUE SCAN              | PK_GY_KSDM                     |     1 |       |     0   (0)| 00:00:01 |
|  74 |      NESTED LOOPS                    |                                |   135 | 38610 | 13134   (3)| 00:02:38 |
|  75 |       MERGE JOIN CARTESIAN           |                                |   466K|   125M| 13063   (2)| 00:02:37 |
|  76 |        NESTED LOOPS                  |                                |    66 | 16170 |   256   (0)| 00:00:04 |
|  77 |         NESTED LOOPS                 |                                |    63 | 13545 |    67   (0)| 00:00:01 |
|  78 |          NESTED LOOPS                |                                |    63 |  7119 |     4   (0)| 00:00:01 |
|* 79 |           TABLE ACCESS BY INDEX ROWID| EMR_JCSQ                       |     1 |    91 |     3   (0)| 00:00:01 |
|* 80 |            INDEX UNIQUE SCAN         | PK_EMR_JCSQ                    |     1 |       |     2   (0)| 00:00:01 |
|  81 |           TABLE ACCESS BY INDEX ROWID| YS_ZY_JZJL                     |    63 |  1386 |     1   (0)| 00:00:01 |
|* 82 |            INDEX UNIQUE SCAN         | PK_YS_ZY_JZJL                  |     1 |       |     0   (0)| 00:00:01 |
|  83 |          TABLE ACCESS BY INDEX ROWID | ZY_BRRY                        |     1 |   102 |     1   (0)| 00:00:01 |
|* 84 |           INDEX UNIQUE SCAN          | PK_ZY_BRRY                     |     1 |       |     0   (0)| 00:00:01 |
|* 85 |         TABLE ACCESS BY INDEX ROWID  | EMR_JCXM                       |     1 |    30 |     3   (0)| 00:00:01 |
|* 86 |          INDEX RANGE SCAN            | PK_EMR_JCXM                    |     1 |       |     2   (0)| 00:00:01 |
|  87 |        BUFFER SORT                   |                                |  7104 |   249K| 13060   (2)| 00:02:37 |
|* 88 |         VIEW                         |                                |  7104 |   249K|   194   (2)| 00:00:03 |
|* 89 |          WINDOW SORT PUSHED RANK     |                                |  7104 |   215K|   194   (2)| 00:00:03 |
|* 90 |           HASH JOIN                  |                                |  7104 |   215K|   193   (2)| 00:00:03 |
|* 91 |            TABLE ACCESS FULL         | EMR_ZLSFDZ                     |  7104 | 92352 |    17   (0)| 00:00:01 |
|* 92 |            TABLE ACCESS FULL         | GY_YLML                        | 16101 |   283K|   175   (1)| 00:00:03 |
|* 93 |       INDEX UNIQUE SCAN              | PK_EMR_ZLXM                    |     1 |     5 |     0   (0)| 00:00:01 |
|* 94 |   HASH JOIN                          |                                |     1 |    16 |   496   (1)| 00:00:06 |
|  95 |    VIEW                              | ZQ_SQDH2OPEMNO                 |    79 |   474 |    47   (0)| 00:00:01 |
|  96 |     UNION-ALL                        |                                |       |       |            |          |
|  97 |      NESTED LOOPS                    |                                |    41 |  1025 |     4   (0)| 00:00:01 |
|* 98 |       TABLE ACCESS BY INDEX ROWID    | EMR_JCSQ                       |     1 |    17 |     3   (0)| 00:00:01 |
|* 99 |        INDEX UNIQUE SCAN             | PK_EMR_JCSQ                    |     1 |       |     2   (0)| 00:00:01 |
|*100 |       INDEX UNIQUE SCAN              | PK_ZY_BRRY                     |     1 |       |     0   (0)| 00:00:01 |
| 101 |      NESTED LOOPS                    |                                |    38 |  1406 |    43   (0)| 00:00:01 |
| 102 |       NESTED LOOPS                   |                                |    38 |  1178 |     5   (0)| 00:00:01 |
|*103 |        TABLE ACCESS BY INDEX ROWID   | EMR_JCSQ                       |     1 |    23 |     3   (0)| 00:00:01 |
|*104 |         INDEX UNIQUE SCAN            | PK_EMR_JCSQ                    |     1 |       |     2   (0)| 00:00:01 |
|*105 |        INDEX UNIQUE SCAN             | PK_MS_BRDA                     |     1 |       |     1   (0)| 00:00:01 |
|*106 |       INDEX UNIQUE SCAN              | PK_YS_MZ_JZLS                  |     1 |     6 |     1   (0)| 00:00:01 |
| 107 |    VIEW                              |                                |     3 |    30 |   449   (1)| 00:00:06 |
| 108 |     UNION-ALL                        |                                |       |       |            |          |
|*109 |      TABLE ACCESS BY INDEX ROWID     | ZQ_INFO_RECORD_GE              |     1 |    84 |     4   (0)| 00:00:01 |
|*110 |       INDEX RANGE SCAN               | ZY5                            |     1 |       |     3   (0)| 00:00:01 |
|*111 |      TABLE ACCESS FULL               | ZQ_INFO_RECORD_LW              |     1 |    53 |   308   (1)| 00:00:04 |
|*112 |      TABLE ACCESS FULL               | ZQ_INFO_RECORD_LB              |     1 |    46 |   137   (1)| 00:00:02 |
-----------------------------------------------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
 
   1 - filter( EXISTS (SELECT /*+ LEADING ("B" "A") USE_HASH ("A") */ 0 FROM  ( (SELECT /*+ OPT_ESTIMATE (JOIN 
              ("EMR_JCSQ" "ZY_BRRY") SCALE_ROWS=41.338824 ) LEADING ("EMR_JCSQ" "ZY_BRRY") OPT_ESTIMATE (NLJ_INDEX_SCAN 
              "ZY_BRRY" ("EMR_JCSQ") "PK_ZY_BRRY" SCALE_ROWS=41.339443 ) OPT_ESTIMATE (NLJ_INDEX_FILTER "ZY_BRRY" 
              ("EMR_JCSQ") "PK_ZY_BRRY" SCALE_ROWS=41.339443 ) USE_NL ("ZY_BRRY") INDEX_RS_ASC ("ZY_BRRY" "PK_ZY_BRRY") 
              OPT_ESTIMATE (TABLE "EMR_JCSQ" SCALE_ROWS=0.024525 ) INDEX_RS_ASC ("EMR_JCSQ" "PK_EMR_JCSQ") */ "SQDH" 
              "SQDH",NVL(CASE  WHEN "ZY_BRRY"."SFZH" IS NOT NULL THEN '1' ELSE  (SELECT /*+ INDEX_RS_ASC ("GY_DMZD" 
              "PK_GY_DMZD") */ "SPTBM" FROM PORTAL56_HIS."GY_DMZD" "GY_DMZD" WHERE "DMSB"=:B1 AND "DMLB"=132) END ,'9') 
              "CARDTYPE" FROM PORTAL56_HIS."ZY_BRRY" "ZY_BRRY",PORTAL56_HIS."EMR_JCSQ" "EMR_JCSQ" WHERE "SQDH"=:B2 AND 
              "EMR_JCSQ"."JZLX"=2 AND "ZY_BRRY"."ZYH"=TO_NUMBER("EMR_JCSQ"."JZHM")) UNION ALL  (SELECT /*+ OPT_ESTIMATE 
              (JOIN ("MS_BRDA" "EMR_JCSQ") SCALE_ROWS=38.312987 ) OPT_ESTIMATE (JOIN ("YS_MZ_JZLS" "EMR_JCSQ") 
              SCALE_ROWS=41.041020 ) LEADING ("EMR_JCSQ" "MS_BRDA" "YS_MZ_JZLS") OPT_ESTIMATE (NLJ_INDEX_SCAN "MS_BRDA" 
              ("EMR_JCSQ") "PK_MS_BRDA" SCALE_ROWS=38.314323 ) OPT_ESTIMATE (NLJ_INDEX_FILTER "MS_BRDA" ("EMR_JCSQ") 
              "PK_MS_BRDA" SCALE_ROWS=38.314323 ) USE_NL ("MS_BRDA") INDEX_RS_ASC ("MS_BRDA" "PK_MS_BRDA") OPT_ESTIMATE 
              (NLJ_INDEX_FILTER "YS_MZ_JZLS" ("EMR_JCSQ") "PK_YS_MZ_JZLS" SCALE_ROWS=41.042451 ) OPT_ESTIMATE 
              (NLJ_INDEX_SCAN "YS_MZ_JZLS" ("EMR_JCSQ") "PK_YS_MZ_JZLS" SCALE_ROWS=41.042451 ) USE_NL ("YS_MZ_JZLS") INDEX 
              ("YS_MZ_JZLS" "PK_YS_MZ_JZLS") OPT_ESTIMATE (TABLE "EMR_JCSQ" SCALE_ROWS=0.023853 ) INDEX_RS_ASC ("EMR_JCSQ" 
              "PK_EMR_JCSQ") */ "SQDH" "SQDH",NVL(CASE  WHEN "MS_BRDA"."SFZH" IS NOT NULL THEN '1' ELSE  (SELECT /*+ 
              INDEX_RS_ASC ("GY_DMZD" "PK_GY_DMZD") */ "SPTBM" FROM PORTAL56_HIS."GY_DMZD" "GY_DMZD" WHERE "DMSB"=:B3 AND 
              "DMLB"=132) END ,'9') "CARDTYPE" FROM PORTAL56_HIS."MS_BRDA" "MS_BRDA",PORTAL56_HIS."YS_MZ_JZLS" 
              "YS_MZ_JZLS",PORTAL56_HIS."EMR_JCSQ" "EMR_JCSQ" WHERE "SQDH"=:B4 AND "EMR_JCSQ"."JZLX"=1 AND 
              "YS_MZ_JZLS"."JZXH"=TO_NUMBER("EMR_JCSQ"."JZHM") AND "EMR_JCSQ"."BRID"="MS_BRDA"."BRID")) "B", ( (SELECT /*+ 
              OPT_ESTIMATE (INDEX_SCAN "ZQ_INFO_RECORD_GE" "ZY5" SCALE_ROWS=0.000624 ) OPT_ESTIMATE (TABLE 
              "ZQ_INFO_RECORD_GE" SCALE_ROWS=0.000263 ) INDEX_RS_ASC ("ZQ_INFO_RECORD_GE" "ZY5") */ "RPT_NO" "RPT_NO" FROM 
              PORTAL56_HIS."ZQ_INFO_RECORD_GE" "ZQ_INFO_RECORD_GE" WHERE TO_NUMBER("RPT_NO")=:B5 AND 
              SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像' AND 
              "SYSTEM_ID"='pacs1') UNION ALL  (SELECT /*+ FULL ("ZQ_INFO_RECORD_LW") */ "RPT_NO" "RPT_NO" FROM 
              PORTAL56_HIS."ZQ_INFO_RECORD_LW" "ZQ_INFO_RECORD_LW" WHERE "SYSTEM_ID"='pacs1' AND TO_NUMBER("RPT_NO")=:B6 AND 
              SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像') UNION ALL  (SELECT 
              /*+ FULL ("ZQ_INFO_RECORD_LB") */ "RPT_NO" "RPT_NO" FROM PORTAL56_HIS."ZQ_INFO_RECORD_LB" "ZQ_INFO_RECORD_LB" 
              WHERE "SYSTEM_ID"='pacs1' AND TO_NUMBER("RPT_NO")=:B7 AND SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND 
              "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像')) "A" WHERE "B"."SQDH"=TO_NUMBER("A"."RPT_NO")))
   6 - filter(NVL("UPDATE_TIME","RPT_DT")>=TO_DATE(' 2024-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND 
              NVL("UPDATE_TIME","RPT_DT")<=TO_DATE(' 2024-07-30 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
   7 - filter(NVL("UPDATE_TIME","RPT_DT")>=TO_DATE(' 2024-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND 
              NVL("UPDATE_TIME","RPT_DT")<=TO_DATE(' 2024-07-30 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
   8 - filter(NVL("UPDATE_TIME","RPT_DT")>=TO_DATE(' 2024-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND 
              NVL("UPDATE_TIME","RPT_DT")<=TO_DATE(' 2024-07-30 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
  12 - filter("EMR_JCSQ"."JZLX"=2)
  13 - access("SQDH"=TO_NUMBER("A"."RPT_NO"))
  14 - access("ZY_BRRY"."ZYH"=TO_NUMBER("EMR_JCSQ"."JZHM"))
  17 - filter("EMR_JCSQ"."JZLX"=1)
  18 - access("SQDH"=TO_NUMBER("A"."RPT_NO"))
  19 - access("EMR_JCSQ"."BRID"="MS_BRDA"."BRID")
  20 - access("YS_MZ_JZLS"."JZXH"=TO_NUMBER("EMR_JCSQ"."JZHM"))
  24 - access("DMLB"=132 AND "DMSB"=:B1)
  27 - access("MS_GHMX"."SBXH"=:B1)
  29 - access("MS_GHMX_LS"."SBXH"=:B1)
  31 - access("DMLB"=101 AND "DMSB"=:B1)
  33 - access("KSDM"=:B1)
  35 - access("KSDM"=:B1)
  37 - access("YGDM"=:B1)
  39 - access("YGDM"=:B1)
  45 - filter("A"."JZLX"=1 AND CASE "A"."JCLX" WHEN 4 THEN 'pacs1' WHEN 5 THEN 'pacs1' WHEN 6 THEN 'pacs1' 
              WHEN 9 THEN 'pacs1' WHEN 36 THEN 'pacs1' WHEN 1 THEN 'pacs3' WHEN 3 THEN 'pacs3' WHEN 8 THEN 'pacs3' WHEN 38 
              THEN 'pacs4' WHEN 39 THEN 'pacs4' WHEN 2 THEN 'pacs5' WHEN 37 THEN 'pacs5' WHEN 7 THEN 'pacs6' ELSE 'pacs1' 
              END ='pacs1' AND "A"."ZFBZ"=0)
  46 - access("A"."SQDH"=TO_NUMBER("RPT_NO"))
  48 - access("C"."JZXH"=TO_NUMBER("A"."JZHM"))
  50 - access("A"."BRID"="B"."BRID")
  51 - filter(TRIM("D"."JCMC")<>'X线摄影' AND TRIM("D"."JCMC")<>'CT成像')
  52 - access("D"."SQDH"=TO_NUMBER("RPT_NO"))
  54 - filter("RN"=1)
  55 - filter(ROW_NUMBER() OVER ( PARTITION BY "A"."ZLXMID" ORDER BY INTERNAL_FUNCTION("BZJG") DESC )<=1)
  56 - access("A"."FYXH"="FYXH")
  57 - filter("JGID"=0 OR "JGID"=1)
  58 - filter("ZFPB"<>1)
  59 - access("E"."ZLXMID"=TO_NUMBER(TO_CHAR("ZLXMID")))
       filter("D"."ZLXMID"="E"."ZLXMID")
  61 - access("DMLB"=132 AND "DMSB"=:B1)
  63 - access("DMLB"=101 AND "DMSB"=:B1)
  65 - access("KSDM"=:B1)
  67 - access("KSDM"=:B1)
  69 - access("YGDM"=:B1)
  71 - access("YGDM"=:B1)
  73 - access("KSDM"=:B1)
  79 - filter("A"."JZLX"=2 AND CASE "A"."JCLX" WHEN 4 THEN 'pacs1' WHEN 5 THEN 'pacs1' WHEN 6 THEN 'pacs1' 
              WHEN 9 THEN 'pacs1' WHEN 36 THEN 'pacs1' WHEN 1 THEN 'pacs3' WHEN 3 THEN 'pacs3' WHEN 8 THEN 'pacs3' WHEN 38 
              THEN 'pacs4' WHEN 39 THEN 'pacs4' WHEN 2 THEN 'pacs5' WHEN 37 THEN 'pacs5' WHEN 7 THEN 'pacs6' ELSE 'pacs1' 
              END ='pacs1' AND "A"."ZFBZ"=0)
  80 - access("A"."SQDH"=TO_NUMBER("RPT_NO"))
  82 - access("A"."JZHM"="C"."JZHM")
  84 - access("B"."ZYH"=TO_NUMBER("A"."JZHM"))
  85 - filter(TRIM("D"."JCMC")<>'X线摄影' AND TRIM("D"."JCMC")<>'CT成像')
  86 - access("D"."SQDH"=TO_NUMBER("RPT_NO"))
  88 - filter("RN"=1)
  89 - filter(ROW_NUMBER() OVER ( PARTITION BY "A"."ZLXMID" ORDER BY INTERNAL_FUNCTION("BZJG") DESC )<=1)
  90 - access("A"."FYXH"="FYXH")
  91 - filter("JGID"=0 OR "JGID"=1)
  92 - filter("ZFPB"<>1)
  93 - access("E"."ZLXMID"=TO_NUMBER(TO_CHAR("ZLXMID")))
       filter("D"."ZLXMID"="E"."ZLXMID")
  94 - access("B"."SQDH"=TO_NUMBER("A"."RPT_NO"))
  98 - filter("EMR_JCSQ"."JZLX"=2)
  99 - access("SQDH"=:B1)
 100 - access("ZY_BRRY"."ZYH"=TO_NUMBER("EMR_JCSQ"."JZHM"))
 103 - filter("EMR_JCSQ"."JZLX"=1)
 104 - access("SQDH"=:B1)
 105 - access("EMR_JCSQ"."BRID"="MS_BRDA"."BRID")
 106 - access("YS_MZ_JZLS"."JZXH"=TO_NUMBER("EMR_JCSQ"."JZHM"))
 109 - filter("PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像' AND "SYSTEM_ID"='pacs1')
 110 - access(SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND TO_NUMBER("RPT_NO")=:B1)
 111 - filter("SYSTEM_ID"='pacs1' AND TO_NUMBER("RPT_NO")=:B1 AND SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND 
              "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像')
 112 - filter("SYSTEM_ID"='pacs1' AND TO_NUMBER("RPT_NO")=:B1 AND SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND 
              "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像')

2- Using SQL Profile
--------------------
Plan hash value: 307111355

----------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                         | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
----------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                  |                                | 31377 |    35M|       |   101K  (1)| 00:20:16 |
|*  1 |  FILTER                           |                                |       |       |       |            |          |
|*  2 |   HASH JOIN                       |                                | 31378 |    35M|       |   100K  (1)| 00:20:10 |
|*  3 |    HASH JOIN                      |                                |  4123 |   136K|  4392K| 46111   (1)| 00:09:14 |
|   4 |     VIEW                          |                                |   112K|  3071K|       | 17135   (1)| 00:03:26 |
|   5 |      UNION-ALL                    |                                |       |       |       |            |          |
|*  6 |       TABLE ACCESS FULL           | ZQ_SAMPLING_RECORD_GE          | 90049 |  2374K|       | 16348   (1)| 00:03:17 |
|*  7 |       TABLE ACCESS FULL           | ZQ_SAMPLING_RECORD_LW          | 14221 |   374K|       |   583   (1)| 00:00:07 |
|*  8 |       TABLE ACCESS FULL           | ZQ_SAMPLING_RECORD_LB          |  8074 |   220K|       |   205   (1)| 00:00:03 |
|   9 |     VIEW                          | ZQ_SQDH2OPEMNO                 |   910K|  5336K|       | 27971   (1)| 00:05:36 |
|  10 |      UNION-ALL                    |                                |       |       |       |            |          |
|* 11 |       HASH JOIN                   |                                |   510K|    12M|       | 10723   (1)| 00:02:09 |
|* 12 |        TABLE ACCESS FULL          | EMR_JCSQ                       | 12353 |   205K|       |  8990   (1)| 00:01:48 |
|  13 |        TABLE ACCESS FULL          | ZY_BRRY                        | 86346 |   674K|       |  1729   (2)| 00:00:21 |
|* 14 |       HASH JOIN                   |                                |   400K|    14M|    11M| 17248   (2)| 00:03:27 |
|  15 |        TABLE ACCESS FULL          | MS_BRDA                        |   610K|  4766K|       |  5317   (2)| 00:01:04 |
|* 16 |        HASH JOIN                  |                                |   400K|    11M|       | 10563   (1)| 00:02:07 |
|* 17 |         TABLE ACCESS FULL         | EMR_JCSQ                       |  9750 |   218K|       |  8990   (1)| 00:01:48 |
|  18 |         INDEX FAST FULL SCAN      | PK_YS_MZ_JZLS                  |  1668K|  9777K|       |  1560   (2)| 00:00:19 |
|  19 |    VIEW                           | EMR_INSPECTION_DOCUMENT_RECORD |   850K|   927M|       | 54686   (2)| 00:10:57 |
|  20 |     UNION-ALL                     |                                |       |       |       |            |          |
|  21 |      TABLE ACCESS BY INDEX ROWID  | GY_DMZD                        |     1 |    10 |       |     2   (0)| 00:00:01 |
|* 22 |       INDEX UNIQUE SCAN           | PK_GY_DMZD                     |     1 |       |       |     1   (0)| 00:00:01 |
|  23 |      VIEW                         | V_MS_GHMX                      |     2 |    52 |       |     5   (0)| 00:00:01 |
|  24 |       UNION-ALL                   |                                |       |       |       |            |          |
|* 25 |        INDEX RANGE SCAN           | ZY3                            |     1 |     9 |       |     3   (0)| 00:00:01 |
|  26 |        TABLE ACCESS BY INDEX ROWID| MS_GHMX_LS                     |     1 |     8 |       |     2   (0)| 00:00:01 |
|* 27 |         INDEX UNIQUE SCAN         | PK_MS_GHMX_LS                  |     1 |       |       |     1   (0)| 00:00:01 |
|  28 |      TABLE ACCESS BY INDEX ROWID  | EMR_DMZD                       |     1 |    10 |       |     2   (0)| 00:00:01 |
|* 29 |       INDEX UNIQUE SCAN           | PK_EMR_DMZD                    |     1 |       |       |     1   (0)| 00:00:01 |
|  30 |      TABLE ACCESS BY INDEX ROWID  | GY_KSDM                        |     1 |     9 |       |     1   (0)| 00:00:01 |
|* 31 |       INDEX UNIQUE SCAN           | PK_GY_KSDM                     |     1 |       |       |     0   (0)| 00:00:01 |
|  32 |      TABLE ACCESS BY INDEX ROWID  | GY_KSDM                        |     1 |    14 |       |     1   (0)| 00:00:01 |
|* 33 |       INDEX UNIQUE SCAN           | PK_GY_KSDM                     |     1 |       |       |     0   (0)| 00:00:01 |
|  34 |      TABLE ACCESS BY INDEX ROWID  | GY_YGDM                        |     1 |    18 |       |     2   (0)| 00:00:01 |
|* 35 |       INDEX UNIQUE SCAN           | PK_GY_YGDM                     |     1 |       |       |     1   (0)| 00:00:01 |
|  36 |      TABLE ACCESS BY INDEX ROWID  | GY_YGDM                        |     1 |    14 |       |     2   (0)| 00:00:01 |
|* 37 |       INDEX UNIQUE SCAN           | PK_GY_YGDM                     |     1 |       |       |     1   (0)| 00:00:01 |
|* 38 |      HASH JOIN                    |                                |   285K|    75M|       | 35603   (2)| 00:07:08 |
|* 39 |       VIEW                        |                                |  7104 |   249K|       |   194   (2)| 00:00:03 |
|* 40 |        WINDOW SORT PUSHED RANK    |                                |  7104 |   215K|       |   194   (2)| 00:00:03 |
|* 41 |         HASH JOIN                 |                                |  7104 |   215K|       |   193   (2)| 00:00:03 |
|* 42 |          TABLE ACCESS FULL        | EMR_ZLSFDZ                     |  7104 | 92352 |       |    17   (0)| 00:00:01 |
|* 43 |          TABLE ACCESS FULL        | GY_YLML                        | 16101 |   283K|       |   175   (1)| 00:00:03 |
|* 44 |       HASH JOIN                   |                                |   317K|    72M|       | 35406   (2)| 00:07:05 |
|  45 |        INDEX FAST FULL SCAN       | PK_EMR_ZLXM                    |  4421 | 22105 |       |     4   (0)| 00:00:01 |
|* 46 |        HASH JOIN                  |                                |   311K|    70M|    50M| 35400   (2)| 00:07:05 |
|* 47 |         HASH JOIN                 |                                |   311K|    46M|    37M| 24953   (2)| 00:05:00 |
|* 48 |          TABLE ACCESS FULL        | EMR_JCXM                       |   939K|    26M|       |  2793   (3)| 00:00:34 |
|* 49 |          HASH JOIN                |                                |   291K|    35M|       | 18363   (1)| 00:03:41 |
|* 50 |           TABLE ACCESS FULL       | EMR_JCSQ                       |  4002 |   375K|       |  9033   (1)| 00:01:49 |
|  51 |           TABLE ACCESS FULL       | YS_MZ_JZLS                     |  1668K|    49M|       |  9317   (1)| 00:01:52 |
|  52 |         TABLE ACCESS FULL         | MS_BRDA                        |   610K|    45M|       |  5317   (2)| 00:01:04 |
|  53 |      TABLE ACCESS BY INDEX ROWID  | GY_DMZD                        |     1 |    10 |       |     2   (0)| 00:00:01 |
|* 54 |       INDEX UNIQUE SCAN           | PK_GY_DMZD                     |     1 |       |       |     1   (0)| 00:00:01 |
|  55 |      TABLE ACCESS BY INDEX ROWID  | EMR_DMZD                       |     1 |    10 |       |     2   (0)| 00:00:01 |
|* 56 |       INDEX UNIQUE SCAN           | PK_EMR_DMZD                    |     1 |       |       |     1   (0)| 00:00:01 |
|  57 |      TABLE ACCESS BY INDEX ROWID  | GY_KSDM                        |     1 |     9 |       |     1   (0)| 00:00:01 |
|* 58 |       INDEX UNIQUE SCAN           | PK_GY_KSDM                     |     1 |       |       |     0   (0)| 00:00:01 |
|  59 |      TABLE ACCESS BY INDEX ROWID  | GY_KSDM                        |     1 |    14 |       |     1   (0)| 00:00:01 |
|* 60 |       INDEX UNIQUE SCAN           | PK_GY_KSDM                     |     1 |       |       |     0   (0)| 00:00:01 |
|  61 |      TABLE ACCESS BY INDEX ROWID  | GY_YGDM                        |     1 |    18 |       |     2   (0)| 00:00:01 |
|* 62 |       INDEX UNIQUE SCAN           | PK_GY_YGDM                     |     1 |       |       |     1   (0)| 00:00:01 |
|  63 |      TABLE ACCESS BY INDEX ROWID  | GY_YGDM                        |     1 |    14 |       |     2   (0)| 00:00:01 |
|* 64 |       INDEX UNIQUE SCAN           | PK_GY_YGDM                     |     1 |       |       |     1   (0)| 00:00:01 |
|  65 |      TABLE ACCESS BY INDEX ROWID  | GY_KSDM                        |     1 |    14 |       |     1   (0)| 00:00:01 |
|* 66 |       INDEX UNIQUE SCAN           | PK_GY_KSDM                     |     1 |       |       |     0   (0)| 00:00:01 |
|* 67 |      HASH JOIN                    |                                |   564K|   154M|       | 19083   (2)| 00:03:49 |
|* 68 |       VIEW                        |                                |  7104 |   249K|       |   194   (2)| 00:00:03 |
|* 69 |        WINDOW SORT PUSHED RANK    |                                |  7104 |   215K|       |   194   (2)| 00:00:03 |
|* 70 |         HASH JOIN                 |                                |  7104 |   215K|       |   193   (2)| 00:00:03 |
|* 71 |          TABLE ACCESS FULL        | EMR_ZLSFDZ                     |  7104 | 92352 |       |    17   (0)| 00:00:01 |
|* 72 |          TABLE ACCESS FULL        | GY_YLML                        | 16101 |   283K|       |   175   (1)| 00:00:03 |
|* 73 |       HASH JOIN                   |                                |   279K|    66M|  9616K| 18884   (2)| 00:03:47 |
|  74 |        TABLE ACCESS FULL          | ZY_BRRY                        | 86346 |  8600K|       |  1729   (2)| 00:00:21 |
|* 75 |        HASH JOIN                  |                                |   279K|    39M|  2832K| 14568   (2)| 00:02:55 |
|  76 |         TABLE ACCESS FULL         | YS_ZY_JZJL                     | 85062 |  1827K|       |   757   (1)| 00:00:10 |
|* 77 |         HASH JOIN                 |                                |   279K|    33M|       | 11844   (2)| 00:02:23 |
|  78 |          INDEX FAST FULL SCAN     | PK_EMR_ZLXM                    |  4421 | 22105 |       |     4   (0)| 00:00:01 |
|* 79 |          HASH JOIN                |                                |   284K|    32M|       | 11837   (2)| 00:02:23 |
|* 80 |           TABLE ACCESS FULL       | EMR_JCSQ                       |  4932 |   438K|       |  9036   (1)| 00:01:49 |
|* 81 |           TABLE ACCESS FULL       | EMR_JCXM                       |   939K|    26M|       |  2793   (3)| 00:00:34 |
|  82 |   NESTED LOOPS                    |                                |     1 |    11 |       |   154   (1)| 00:00:02 |
|  83 |    VIEW                           |                                |     3 |    30 |       |   150   (1)| 00:00:02 |
|  84 |     UNION-ALL                     |                                |       |       |       |            |          |
|* 85 |      TABLE ACCESS BY INDEX ROWID  | ZQ_INFO_RECORD_GE              |     1 |    84 |       |     4   (0)| 00:00:01 |
|* 86 |       INDEX RANGE SCAN            | ZY5                            |     1 |       |       |     3   (0)| 00:00:01 |
|* 87 |      TABLE ACCESS FULL            | ZQ_INFO_RECORD_LW              |     1 |    53 |       |   308   (1)| 00:00:04 |
|* 88 |      TABLE ACCESS FULL            | ZQ_INFO_RECORD_LB              |     1 |    46 |       |   137   (1)| 00:00:02 |
|* 89 |    VIEW                           | ZQ_SQDH2OPEMNO                 |     1 |     1 |       |     4   (0)| 00:00:01 |
|  90 |     UNION-ALL                     |                                |       |       |       |            |          |
|  91 |      NESTED LOOPS                 |                                |    41 |  1025 |       |     4   (0)| 00:00:01 |
|* 92 |       TABLE ACCESS BY INDEX ROWID | EMR_JCSQ                       |     1 |    17 |       |     3   (0)| 00:00:01 |
|* 93 |        INDEX UNIQUE SCAN          | PK_EMR_JCSQ                    |     1 |       |       |     2   (0)| 00:00:01 |
|* 94 |       INDEX UNIQUE SCAN           | PK_ZY_BRRY                     |     1 |       |       |     0   (0)| 00:00:01 |
|  95 |      NESTED LOOPS                 |                                |     1 |    37 |       |    43   (0)| 00:00:01 |
|  96 |       NESTED LOOPS                |                                |    38 |  1178 |       |     5   (0)| 00:00:01 |
|* 97 |        TABLE ACCESS BY INDEX ROWID| EMR_JCSQ                       |     1 |    23 |       |     3   (0)| 00:00:01 |
|* 98 |         INDEX UNIQUE SCAN         | PK_EMR_JCSQ                    |     1 |       |       |     2   (0)| 00:00:01 |
|* 99 |        INDEX UNIQUE SCAN          | PK_MS_BRDA                     |     1 |       |       |     1   (0)| 00:00:01 |
|*100 |       INDEX UNIQUE SCAN           | PK_YS_MZ_JZLS                  |     1 |     6 |       |     1   (0)| 00:00:01 |
----------------------------------------------------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
 
   1 - filter( EXISTS (SELECT 0 FROM  ( (SELECT /*+ OPT_ESTIMATE (JOIN ("ZY_BRRY" "EMR_JCSQ") SCALE_ROWS=41.338824 
              ) OPT_ESTIMATE (NLJ_INDEX_SCAN "ZY_BRRY" ("EMR_JCSQ") "PK_ZY_BRRY" SCALE_ROWS=41.339443 ) OPT_ESTIMATE 
              (NLJ_INDEX_FILTER "ZY_BRRY" ("EMR_JCSQ") "PK_ZY_BRRY" SCALE_ROWS=41.339443 ) OPT_ESTIMATE (TABLE "EMR_JCSQ" 
              SCALE_ROWS=0.024525 ) */ "SQDH" "SQDH",NVL(CASE  WHEN "ZY_BRRY"."SFZH" IS NOT NULL THEN '1' ELSE  (SELECT "SPTBM" 
              FROM PORTAL56_HIS."GY_DMZD" "GY_DMZD" WHERE "DMSB"=:B1 AND "DMLB"=132) END ,'9') "CARDTYPE" FROM 
              PORTAL56_HIS."ZY_BRRY" "ZY_BRRY",PORTAL56_HIS."EMR_JCSQ" "EMR_JCSQ" WHERE "SQDH"=:B2 AND "EMR_JCSQ"."JZLX"=2 AND 
              "ZY_BRRY"."ZYH"=TO_NUMBER("EMR_JCSQ"."JZHM")) UNION ALL  (SELECT /*+ OPT_ESTIMATE (JOIN ("MS_BRDA" "EMR_JCSQ") 
              SCALE_ROWS=38.312987 ) OPT_ESTIMATE (JOIN ("YS_MZ_JZLS" "EMR_JCSQ") SCALE_ROWS=41.041020 ) OPT_ESTIMATE 
              (NLJ_INDEX_SCAN "MS_BRDA" ("EMR_JCSQ") "PK_MS_BRDA" SCALE_ROWS=38.314323 ) OPT_ESTIMATE (NLJ_INDEX_FILTER "MS_BRDA" 
              ("EMR_JCSQ") "PK_MS_BRDA" SCALE_ROWS=38.314323 ) OPT_ESTIMATE (NLJ_INDEX_FILTER "YS_MZ_JZLS" ("EMR_JCSQ") 
              "PK_YS_MZ_JZLS" SCALE_ROWS=41.042451 ) OPT_ESTIMATE (NLJ_INDEX_SCAN "YS_MZ_JZLS" ("EMR_JCSQ") "PK_YS_MZ_JZLS" 
              SCALE_ROWS=41.042451 ) OPT_ESTIMATE (TABLE "EMR_JCSQ" SCALE_ROWS=0.023853 ) */ "SQDH" "SQDH",NVL(CASE  WHEN 
              "MS_BRDA"."SFZH" IS NOT NULL THEN '1' ELSE  (SELECT "SPTBM" FROM PORTAL56_HIS."GY_DMZD" "GY_DMZD" WHERE "DMSB"=:B3 
              AND "DMLB"=132) END ,'9') "CARDTYPE" FROM PORTAL56_HIS."MS_BRDA" "MS_BRDA",PORTAL56_HIS."YS_MZ_JZLS" 
              "YS_MZ_JZLS",PORTAL56_HIS."EMR_JCSQ" "EMR_JCSQ" WHERE "SQDH"=:B4 AND "EMR_JCSQ"."JZLX"=1 AND 
              "YS_MZ_JZLS"."JZXH"=TO_NUMBER("EMR_JCSQ"."JZHM") AND "EMR_JCSQ"."BRID"="MS_BRDA"."BRID")) "B", ( (SELECT /*+ 
              OPT_ESTIMATE (INDEX_SCAN "ZQ_INFO_RECORD_GE" "ZY5" SCALE_ROWS=0.000624 ) OPT_ESTIMATE (TABLE "ZQ_INFO_RECORD_GE" 
              SCALE_ROWS=0.000263 ) */ "RPT_NO" "RPT_NO" FROM PORTAL56_HIS."ZQ_INFO_RECORD_GE" "ZQ_INFO_RECORD_GE" WHERE 
              TO_NUMBER("RPT_NO")=:B5 AND SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像' 
              AND "SYSTEM_ID"='pacs1') UNION ALL  (SELECT "RPT_NO" "RPT_NO" FROM PORTAL56_HIS."ZQ_INFO_RECORD_LW" 
              "ZQ_INFO_RECORD_LW" WHERE "SYSTEM_ID"='pacs1' AND TO_NUMBER("RPT_NO")=:B6 AND 
              SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像') UNION ALL  (SELECT 
              "RPT_NO" "RPT_NO" FROM PORTAL56_HIS."ZQ_INFO_RECORD_LB" "ZQ_INFO_RECORD_LB" WHERE "SYSTEM_ID"='pacs1' AND 
              TO_NUMBER("RPT_NO")=:B7 AND SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND "PROJ_NAME"<>'X线摄影' AND 
              "PROJ_NAME"<>'CT成像')) "A" WHERE "B"."SQDH"=TO_NUMBER("A"."RPT_NO")))
   2 - access("A"."RPT_NO"=TO_NUMBER("RPT_NO"))
   3 - access("B"."SQDH"=TO_NUMBER("A"."RPT_NO"))
   6 - filter(NVL("UPDATE_TIME","RPT_DT")>=TO_DATE(' 2024-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND 
              NVL("UPDATE_TIME","RPT_DT")<=TO_DATE(' 2024-07-30 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
   7 - filter(NVL("UPDATE_TIME","RPT_DT")>=TO_DATE(' 2024-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND 
              NVL("UPDATE_TIME","RPT_DT")<=TO_DATE(' 2024-07-30 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
   8 - filter(NVL("UPDATE_TIME","RPT_DT")>=TO_DATE(' 2024-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND 
              NVL("UPDATE_TIME","RPT_DT")<=TO_DATE(' 2024-07-30 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
  11 - access("ZY_BRRY"."ZYH"=TO_NUMBER("EMR_JCSQ"."JZHM"))
  12 - filter("EMR_JCSQ"."JZLX"=2)
  14 - access("EMR_JCSQ"."BRID"="MS_BRDA"."BRID")
  16 - access("YS_MZ_JZLS"."JZXH"=TO_NUMBER("EMR_JCSQ"."JZHM"))
  17 - filter("EMR_JCSQ"."JZLX"=1)
  22 - access("DMLB"=132 AND "DMSB"=:B1)
  25 - access("MS_GHMX"."SBXH"=:B1)
  27 - access("MS_GHMX_LS"."SBXH"=:B1)
  29 - access("DMLB"=101 AND "DMSB"=:B1)
  31 - access("KSDM"=:B1)
  33 - access("KSDM"=:B1)
  35 - access("YGDM"=:B1)
  37 - access("YGDM"=:B1)
  38 - access("E"."ZLXMID"=TO_NUMBER(TO_CHAR("ZLXMID")))
  39 - filter("RN"=1)
  40 - filter(ROW_NUMBER() OVER ( PARTITION BY "A"."ZLXMID" ORDER BY INTERNAL_FUNCTION("BZJG") DESC )<=1)
  41 - access("A"."FYXH"="FYXH")
  42 - filter("JGID"=0 OR "JGID"=1)
  43 - filter("ZFPB"<>1)
  44 - access("D"."ZLXMID"="E"."ZLXMID")
  46 - access("A"."BRID"="B"."BRID")
  47 - access("A"."SQDH"="D"."SQDH")
  48 - filter(TRIM("D"."JCMC")<>'X线摄影' AND TRIM("D"."JCMC")<>'CT成像')
  49 - access("C"."JZXH"=TO_NUMBER("A"."JZHM"))
  50 - filter("A"."JZLX"=1 AND CASE "A"."JCLX" WHEN 4 THEN 'pacs1' WHEN 5 THEN 'pacs1' WHEN 6 THEN 'pacs1' WHEN 9 
              THEN 'pacs1' WHEN 36 THEN 'pacs1' WHEN 1 THEN 'pacs3' WHEN 3 THEN 'pacs3' WHEN 8 THEN 'pacs3' WHEN 38 THEN 'pacs4' 
              WHEN 39 THEN 'pacs4' WHEN 2 THEN 'pacs5' WHEN 37 THEN 'pacs5' WHEN 7 THEN 'pacs6' ELSE 'pacs1' END ='pacs1' AND 
              "A"."ZFBZ"=0)
  54 - access("DMLB"=132 AND "DMSB"=:B1)
  56 - access("DMLB"=101 AND "DMSB"=:B1)
  58 - access("KSDM"=:B1)
  60 - access("KSDM"=:B1)
  62 - access("YGDM"=:B1)
  64 - access("YGDM"=:B1)
  66 - access("KSDM"=:B1)
  67 - access("E"."ZLXMID"=TO_NUMBER(TO_CHAR("ZLXMID")))
  68 - filter("RN"=1)
  69 - filter(ROW_NUMBER() OVER ( PARTITION BY "A"."ZLXMID" ORDER BY INTERNAL_FUNCTION("BZJG") DESC )<=1)
  70 - access("A"."FYXH"="FYXH")
  71 - filter("JGID"=0 OR "JGID"=1)
  72 - filter("ZFPB"<>1)
  73 - access("B"."ZYH"=TO_NUMBER("A"."JZHM"))
  75 - access("A"."JZHM"="C"."JZHM")
  77 - access("D"."ZLXMID"="E"."ZLXMID")
  79 - access("A"."SQDH"="D"."SQDH")
  80 - filter("A"."JZLX"=2 AND CASE "A"."JCLX" WHEN 4 THEN 'pacs1' WHEN 5 THEN 'pacs1' WHEN 6 THEN 'pacs1' WHEN 9 
              THEN 'pacs1' WHEN 36 THEN 'pacs1' WHEN 1 THEN 'pacs3' WHEN 3 THEN 'pacs3' WHEN 8 THEN 'pacs3' WHEN 38 THEN 'pacs4' 
              WHEN 39 THEN 'pacs4' WHEN 2 THEN 'pacs5' WHEN 37 THEN 'pacs5' WHEN 7 THEN 'pacs6' ELSE 'pacs1' END ='pacs1' AND 
              "A"."ZFBZ"=0)
  81 - filter(TRIM("D"."JCMC")<>'X线摄影' AND TRIM("D"."JCMC")<>'CT成像')
  85 - filter("PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像' AND "SYSTEM_ID"='pacs1')
  86 - access(SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND TO_NUMBER("RPT_NO")=:B1)
  87 - filter("SYSTEM_ID"='pacs1' AND TO_NUMBER("RPT_NO")=:B1 AND SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND 
              "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像')
  88 - filter("SYSTEM_ID"='pacs1' AND TO_NUMBER("RPT_NO")=:B1 AND SUBSTR("RIS_STUDY_ID",1,36)='GE2378521' AND 
              "PROJ_NAME"<>'X线摄影' AND "PROJ_NAME"<>'CT成像')
  89 - filter("B"."SQDH"=TO_NUMBER("A"."RPT_NO"))
  92 - filter("EMR_JCSQ"."JZLX"=2)
  93 - access("SQDH"=:B1)
  94 - access("ZY_BRRY"."ZYH"=TO_NUMBER("EMR_JCSQ"."JZHM"))
  97 - filter("EMR_JCSQ"."JZLX"=1)
  98 - access("SQDH"=:B1)
  99 - access("EMR_JCSQ"."BRID"="MS_BRDA"."BRID")
 100 - access("YS_MZ_JZLS"."JZXH"=TO_NUMBER("EMR_JCSQ"."JZHM"))

-------------------------------------------------------------------------------
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值