Oracle执行计划的稳定(使用MANUAL类型的SQL PROFILE)

2024-06-03 22:48

本文主要是介绍Oracle执行计划的稳定(使用MANUAL类型的SQL PROFILE),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

使用MANUAL类型的SQL PROFILE来稳定执行计划

手动类型的SQL PROFILE总的来说就修改HINT,就是将COST较少的HINT部分复制到COST较多的里面去。就是执行计划中的Outline Data部分。

1、环境准备

SCOTT@TNS_PDB01>create table t1(n number);Table created.SCOTT@TNS_PDB01>ed
Wrote file afiedt.buf1  declare2  begin3  	for i in 1 .. 10000 loop4  		insert into t1 values(i);5  	end loop;6  	commit;7* end;8  /PL/SQL procedure successfully completed.SCOTT@TNS_PDB01>select count(*) from t1;COUNT(*)
----------10000SCOTT@TNS_PDB01>create index idx_t1 on t1(n);Index created.SCOTT@TNS_PDB01>exec dbms_stats.gather_table_stats(ownname => 'SCOTT',tabname => 'T1',estimate_percent => 100,cascade => true,no_invalidate => false);PL/SQL procedure successfully completed.

2、分别使用NO_INDEX和INDEX执行下列语句生成不同的执行计划

SCOTT@TNS_PDB01>select /*+ no_index(t1 idx_t1) */* from t1 where n = 5;N
----------5SCOTT@TNS_PDB01>select /*+ index(t1 idx_t1) */* from t1 where n = 5;N
----------5SCOTT@TNS_PDB01>select sql_text,sql_id,plan_hash_value,version_count,executions from v$sqlarea where sql_text like '%from t1 where n = 5%';SQL_TEXT			    SQL_ID	  PLAN_HASH_VALUE VERSION_COUNT EXECUTIONS
----------------------------------- ------------- --------------- ------------- ----------
select sql_text,sql_id,plan_hash_va cn3cdtrt0scbj	232555890	      1 	 1
lue,version_count,executions from v
$sqlarea where sql_text like '%fromt1 where n = 5%'select /*+ no_index(t1 idx_t1) */*  6km0nbhw11mvq      3617692013	      1 	 3
from t1 where n = 5select /*+ index(t1 idx_t1) */* fro 0j50kmxrzm6nh      1369807930	      1 	 3
m t1 where n = 5SCOTT@TNS_PDB01>select * from table(dbms_xplan.display_cursor(sql_id => '6km0nbhw11mvq',cursor_child_no => 0,format => 'advanced'));PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------------------------------
SQL_ID	6km0nbhw11mvq, child number 0
-------------------------------------
select /*+ no_index(t1 idx_t1) */* from t1 where n = 5Plan hash value: 3617692013--------------------------------------------------------------------------
| Id  | Operation	  | Name | Rows  | Bytes | Cost (%CPU)| Time	 |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |	 |	 |	 |     7 (100)| 	 |
|*  1 |  TABLE ACCESS FULL| T1	 |     1 |     4 |     7   (0)| 00:00:01 |
--------------------------------------------------------------------------Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------1 - SEL$1 / T1@SEL$1Outline Data
-------------/*+BEGIN_OUTLINE_DATAIGNORE_OPTIM_EMBEDDED_HINTSOPTIMIZER_FEATURES_ENABLE('19.1.0')DB_VERSION('19.1.0')ALL_ROWSOUTLINE_LEAF(@"SEL$1")FULL(@"SEL$1" "T1"@"SEL$1")END_OUTLINE_DATA*/Predicate Information (identified by operation id):
---------------------------------------------------1 - filter("N"=5)Column Projection Information (identified by operation id):
-----------------------------------------------------------1 - "N"[NUMBER,22]Hint Report (identified by operation id / Query Block Name / Object Alias):
Total hints for statement: 1
---------------------------------------------------------------------------1 -	SEL$1 / T1@SEL$1-  no_index(t1 idx_t1)Query Block Registry:
---------------------<q o="2" f="y"><n><![CDATA[SEL$1]]></n><f><h><t><![CDATA[T1]]></t><s><![CDATA[SEL$1]]></s></h></f></q>56 rows selected.SCOTT@TNS_PDB01>select * from table(dbms_xplan.display_cursor(sql_id => '0j50kmxrzm6nh',cursor_child_no => 0,format => 'advanced'));PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------------------------------
SQL_ID	0j50kmxrzm6nh, child number 0
-------------------------------------
select /*+ index(t1 idx_t1) */* from t1 where n = 5Plan hash value: 1369807930---------------------------------------------------------------------------
| Id  | Operation	 | Name   | Rows  | Bytes | Cost (%CPU)| Time	  |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT |	  |	  |	  |	1 (100)|	  |
|*  1 |  INDEX RANGE SCAN| IDX_T1 |	1 |	4 |	1   (0)| 00:00:01 |
---------------------------------------------------------------------------Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------1 - SEL$1 / T1@SEL$1Outline Data
-------------/*+BEGIN_OUTLINE_DATAIGNORE_OPTIM_EMBEDDED_HINTSOPTIMIZER_FEATURES_ENABLE('19.1.0')DB_VERSION('19.1.0')ALL_ROWSOUTLINE_LEAF(@"SEL$1")INDEX(@"SEL$1" "T1"@"SEL$1" ("T1"."N"))END_OUTLINE_DATA*/Predicate Information (identified by operation id):
---------------------------------------------------1 - access("N"=5)Column Projection Information (identified by operation id):
-----------------------------------------------------------1 - "N"[NUMBER,22]Hint Report (identified by operation id / Query Block Name / Object Alias):
Total hints for statement: 1
---------------------------------------------------------------------------1 -	SEL$1 / T1@SEL$1-  index(t1 idx_t1)Query Block Registry:
---------------------<q o="2" f="y"><n><![CDATA[SEL$1]]></n><f><h><t><![CDATA[T1]]></t><s><![CDATA[SEL$1]]></s></h></f></q>56 rows selected.

上传MOS文档上的 coe_xfr_sql_profile.sql到Oracle

[oracle@kkk ~]$ ls -l coe_xfr_sql_profile.sql
-rw-r–r-- 1 oracle oinstall 12957 Jan 13 13:12 coe_xfr_sql_profile.sql

3、使用NO_INDEX的SQL_ID和PLAN_HASH_VALUE执行脚本 coe_xfr_sql_profile.sql

SCOTT@TNS_PDB01>@/home/oracle/coe_xfr_sql_profile.sqlParameter 1:
SQL_ID (required)Enter value for 1: 6km0nbhw11mvqPLAN_HASH_VALUE AVG_ET_SECS
--------------- -----------3617692013        .025Parameter 2:
PLAN_HASH_VALUE (required)Enter value for 2: 3617692013Values passed to coe_xfr_sql_profile:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SQL_ID	       : "6km0nbhw11mvq"
PLAN_HASH_VALUE: "3617692013"SQL>BEGIN2    IF :sql_text IS NULL THEN3  	 RAISE_APPLICATION_ERROR(-20100, 'SQL_TEXT for SQL_ID &&sql_id. was not found in memory (gv$sqltext_with_newlines) or AWR (dba_hist_sqltext).');4    END IF;5  END;6  /
SQL>SET TERM OFF;
SQL>BEGIN2    IF :other_xml IS NULL THEN3  	 RAISE_APPLICATION_ERROR(-20101, 'PLAN for SQL_ID &&sql_id. and PHV &&plan_hash_value. was not found in memory (gv$sql_plan) or AWR (dba_hist_sql_plan).');4    END IF;5  END;6  /
SQL>SET TERM OFF;Execute coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql
on TARGET system in order to create a custom SQL Profile
with plan 3617692013 linked to adjusted sql_text.COE_XFR_SQL_PROFILE completed.SQL>host ls -l /home/oracle/coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql
-rw-r--r-- 1 oracle oinstall 2514 Jan 13 15:37 /home/oracle/coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql

4、INDEX的SQL_ID和PLAN_HASH_VALUE执行脚本 coe_xfr_sql_profile.sql

SQL>@/home/oracle/coe_xfr_sql_profile.sqlParameter 1:
SQL_ID (required)Enter value for 1: 0j50kmxrzm6nhPLAN_HASH_VALUE AVG_ET_SECS
--------------- -----------1369807930        .008Parameter 2:
PLAN_HASH_VALUE (required)Enter value for 2: 1369807930Values passed to coe_xfr_sql_profile:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SQL_ID	       : "0j50kmxrzm6nh"
PLAN_HASH_VALUE: "1369807930"SQL>BEGIN2    IF :sql_text IS NULL THEN3  	 RAISE_APPLICATION_ERROR(-20100, 'SQL_TEXT for SQL_ID &&sql_id. was not found in memory (gv$sqltext_with_newlines) or AWR (dba_hist_sqltext).');4    END IF;5  END;6  /
SQL>SET TERM OFF;
SQL>BEGIN2    IF :other_xml IS NULL THEN3  	 RAISE_APPLICATION_ERROR(-20101, 'PLAN for SQL_ID &&sql_id. and PHV &&plan_hash_value. was not found in memory (gv$sql_plan) or AWR (dba_hist_sql_plan).');4    END IF;5  END;6  /
SQL>SET TERM OFF;Execute coe_xfr_sql_profile_0j50kmxrzm6nh_1369807930.sql
on TARGET system in order to create a custom SQL Profile
with plan 1369807930 linked to adjusted sql_text.COE_XFR_SQL_PROFILE completed.
SQL>
SQL>
SQL>host ls -l /home/oracle/coe_xfr_sql_profile_0j50kmxrzm6nh_1369807930.sql
-rw-r--r-- 1 oracle oinstall 2523 Jan 13 15:39 /home/oracle/coe_xfr_sql_profile_0j50kmxrzm6nh_1369807930.sql

5、将 /home/oracle/coe_xfr_sql_profile_0j50kmxrzm6nh_1369807930.sql中Hint部分替换到/home/oracle/coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql中Hint并将force_match修改为true后执行home/oracle/coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql脚本

SQL>@/home/oracle/coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql
SQL>REM
SQL>REM $Header: 215187.1 coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql 11.4.3.5 2020/01/13 carlos.sierra $
SQL>REM
SQL>REM Copyright (c) 2000-2011, Oracle Corporation. All rights reserved.
SQL>REM
SQL>REM AUTHOR
SQL>REM   carlos.sierra@oracle.com
SQL>REM
SQL>REM SCRIPT
SQL>REM   coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql
SQL>REM
SQL>REM DESCRIPTION
SQL>REM   This script is generated by coe_xfr_sql_profile.sql
SQL>REM   It contains the SQL*Plus commands to create a custom
SQL>REM   SQL Profile for SQL_ID 6km0nbhw11mvq based on plan hash
SQL>REM   value 3617692013.
SQL>REM   The custom SQL Profile to be created by this script
SQL>REM   will affect plans for SQL commands with signature
SQL>REM   matching the one for SQL Text below.
SQL>REM   Review SQL Text and adjust accordingly.
SQL>REM
SQL>REM PARAMETERS
SQL>REM   None.
SQL>REM
SQL>REM EXAMPLE
SQL>REM   SQL> START coe_xfr_sql_profile_6km0nbhw11mvq_3617692013.sql;
SQL>REM
SQL>REM NOTES
SQL>REM   1. Should be run as SYSTEM or SYSDBA.
SQL>REM   2. User must have CREATE ANY SQL PROFILE privilege.
SQL>REM   3. SOURCE and TARGET systems can be the same or similar.
SQL>REM   4. To drop this custom SQL Profile after it has been created:
SQL>REM	 EXEC DBMS_SQLTUNE.DROP_SQL_PROFILE('coe_6km0nbhw11mvq_3617692013');
SQL>REM   5. Be aware that using DBMS_SQLTUNE requires a license
SQL>REM	 for the Oracle Tuning Pack.
SQL>REM
SQL>WHENEVER SQLERROR EXIT SQL.SQLCODE;
SQL>REM
SQL>VAR signature NUMBER;
SQL>REM
SQL>DECLARE2  sql_txt CLOB;3  h	     SYS.SQLPROF_ATTR;4  BEGIN5  sql_txt := q'[6  select /*+ no_index(t1 idx_t1)7  */* from t1 where n = 58  ]';9  h := SYS.SQLPROF_ATTR(10  q'[BEGIN_OUTLINE_DATA]',11  q'[IGNORE_OPTIM_EMBEDDED_HINTS]',12  q'[OPTIMIZER_FEATURES_ENABLE('19.1.0')]',13  q'[DB_VERSION('19.1.0')]',14  q'[ALL_ROWS]',15  q'[OUTLINE_LEAF(@"SEL$1")]',16  q'[INDEX(@"SEL$1" "T1"@"SEL$1" ("T1"."N"))]',17  q'[END_OUTLINE_DATA]');18  :signature := DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(sql_txt);19  DBMS_SQLTUNE.IMPORT_SQL_PROFILE (20  sql_text	 => sql_txt,21  profile	 => h,22  name	 => 'coe_6km0nbhw11mvq_3617692013',23  description => 'coe 6km0nbhw11mvq 3617692013 '||:signature||'',24  category	 => 'DEFAULT',25  validate	 => TRUE,26  replace	 => TRUE,27  force_match => TRUE /* TRUE:FORCE (match even when different literals in SQL). FALSE:EXACT (similar to CURSOR_SHARING) */ );28  END;29  /PL/SQL procedure successfully completed.SQL>WHENEVER SQLERROR CONTINUE
SQL>SET ECHO OFF;SIGNATURE
---------------------1624786848478586381... manual custom SQL Profile has been createdCOE_XFR_SQL_PROFILE_6km0nbhw11mvq_3617692013 completed

6、测试

SQL>select /*+ no_index(t1 idx_t1) */* from t1 where n = 5;N
----------5SQL>select * from table(dbms_xplan.display_cursor(sql_id => null,cursor_child_no => null,format => 'advanced'));PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
SQL_ID	6km0nbhw11mvq, child number 0
-------------------------------------
select /*+ no_index(t1 idx_t1) */* from t1 where n = 5Plan hash value: 1369807930---------------------------------------------------------------------------
| Id  | Operation	 | Name   | Rows  | Bytes | Cost (%CPU)| Time	  |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT |	  |	  |	  |	1 (100)|	  |
|*  1 |  INDEX RANGE SCAN| IDX_T1 |	1 |	4 |	1   (0)| 00:00:01 |PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
---------------------------------------------------------------------------Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------1 - SEL$1 / T1@SEL$1Outline Data
-------------/*+PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------BEGIN_OUTLINE_DATAIGNORE_OPTIM_EMBEDDED_HINTSOPTIMIZER_FEATURES_ENABLE('19.1.0')DB_VERSION('19.1.0')ALL_ROWSOUTLINE_LEAF(@"SEL$1")INDEX(@"SEL$1" "T1"@"SEL$1" ("T1"."N"))END_OUTLINE_DATA*/Predicate Information (identified by operation id):PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
---------------------------------------------------1 - access("N"=5)Column Projection Information (identified by operation id):
-----------------------------------------------------------1 - "N"[NUMBER,22]Hint Report (identified by operation id / Query Block Name / Object Alias):
Total hints for statement: 6 (U - Unused (1))PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
---------------------------------------------------------------------------0 -	STATEMENT-  ALL_ROWS-  DB_VERSION('19.1.0')-  IGNORE_OPTIM_EMBEDDED_HINTS-  OPTIMIZER_FEATURES_ENABLE('19.1.0')1 -	SEL$1 / T1@SEL$1U -  no_index(t1 idx_t1) / rejected by IGNORE_OPTIM_EMBEDDED_HINTS-  INDEX(@"SEL$1" "T1"@"SEL$1" ("T1"."N"))PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------Note
------ SQL profile coe_6km0nbhw11mvq_3617692013 used for this statementQuery Block Registry:
---------------------<q o="2" f="y"><n><![CDATA[SEL$1]]></n><f><h><t><![CDATA[T1]]></t><s><![CDATA[SEL$1]]></s></h></f></q>PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------67 rows selected.发现在使用NO_INDEX的SQL语句中走的索引了。修改谓词条件
SQL>select /*+ no_index(t1 idx_t1) */* from t1 where n = 7;N
----------7SQL>select * from table(dbms_xplan.display_cursor(sql_id => null,cursor_child_no => null,format => 'advanced'));PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
SQL_ID	8up3bffqmutxx, child number 0
-------------------------------------
select /*+ no_index(t1 idx_t1) */* from t1 where n = 7Plan hash value: 1369807930---------------------------------------------------------------------------
| Id  | Operation	 | Name   | Rows  | Bytes | Cost (%CPU)| Time	  |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT |	  |	  |	  |	1 (100)|	  |
|*  1 |  INDEX RANGE SCAN| IDX_T1 |	1 |	4 |	1   (0)| 00:00:01 |PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
---------------------------------------------------------------------------Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------1 - SEL$1 / T1@SEL$1Outline Data
-------------/*+PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------BEGIN_OUTLINE_DATAIGNORE_OPTIM_EMBEDDED_HINTSOPTIMIZER_FEATURES_ENABLE('19.1.0')DB_VERSION('19.1.0')ALL_ROWSOUTLINE_LEAF(@"SEL$1")INDEX(@"SEL$1" "T1"@"SEL$1" ("T1"."N"))END_OUTLINE_DATA*/Predicate Information (identified by operation id):PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
---------------------------------------------------1 - access("N"=7)Column Projection Information (identified by operation id):
-----------------------------------------------------------1 - "N"[NUMBER,22]Hint Report (identified by operation id / Query Block Name / Object Alias):
Total hints for statement: 6 (U - Unused (1))PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
---------------------------------------------------------------------------0 -	STATEMENT-  ALL_ROWS-  DB_VERSION('19.1.0')-  IGNORE_OPTIM_EMBEDDED_HINTS-  OPTIMIZER_FEATURES_ENABLE('19.1.0')1 -	SEL$1 / T1@SEL$1U -  no_index(t1 idx_t1) / rejected by IGNORE_OPTIM_EMBEDDED_HINTS-  INDEX(@"SEL$1" "T1"@"SEL$1" ("T1"."N"))PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------Note
------ SQL profile coe_6km0nbhw11mvq_3617692013 used for this statementQuery Block Registry:
---------------------<q o="2" f="y"><n><![CDATA[SEL$1]]></n><f><h><t><![CDATA[T1]]></t><s><![CDATA[SEL$1]]></s></h></f></q>PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------67 rows selected.修改谓词条件后也走的是索引了,(概要文件中将force_match => TRUE

这篇关于Oracle执行计划的稳定(使用MANUAL类型的SQL PROFILE)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1028337

相关文章

如何使用celery进行异步处理和定时任务(django)

《如何使用celery进行异步处理和定时任务(django)》文章介绍了Celery的基本概念、安装方法、如何使用Celery进行异步任务处理以及如何设置定时任务,通过Celery,可以在Web应用中... 目录一、celery的作用二、安装celery三、使用celery 异步执行任务四、使用celery

使用Python绘制蛇年春节祝福艺术图

《使用Python绘制蛇年春节祝福艺术图》:本文主要介绍如何使用Python的Matplotlib库绘制一幅富有创意的“蛇年有福”艺术图,这幅图结合了数字,蛇形,花朵等装饰,需要的可以参考下... 目录1. 绘图的基本概念2. 准备工作3. 实现代码解析3.1 设置绘图画布3.2 绘制数字“2025”3.3

oracle数据库索引失效的问题及解决

《oracle数据库索引失效的问题及解决》本文总结了在Oracle数据库中索引失效的一些常见场景,包括使用isnull、isnotnull、!=、、、函数处理、like前置%查询以及范围索引和等值索引... 目录oracle数据库索引失效问题场景环境索引失效情况及验证结论一结论二结论三结论四结论五总结ora

Jsoncpp的安装与使用方式

《Jsoncpp的安装与使用方式》JsonCpp是一个用于解析和生成JSON数据的C++库,它支持解析JSON文件或字符串到C++对象,以及将C++对象序列化回JSON格式,安装JsonCpp可以通过... 目录安装jsoncppJsoncpp的使用Value类构造函数检测保存的数据类型提取数据对json数

python使用watchdog实现文件资源监控

《python使用watchdog实现文件资源监控》watchdog支持跨平台文件资源监控,可以检测指定文件夹下文件及文件夹变动,下面我们来看看Python如何使用watchdog实现文件资源监控吧... python文件监控库watchdogs简介随着Python在各种应用领域中的广泛使用,其生态环境也

Python中构建终端应用界面利器Blessed模块的使用

《Python中构建终端应用界面利器Blessed模块的使用》Blessed库作为一个轻量级且功能强大的解决方案,开始在开发者中赢得口碑,今天,我们就一起来探索一下它是如何让终端UI开发变得轻松而高... 目录一、安装与配置:简单、快速、无障碍二、基本功能:从彩色文本到动态交互1. 显示基本内容2. 创建链

springboot整合 xxl-job及使用步骤

《springboot整合xxl-job及使用步骤》XXL-JOB是一个分布式任务调度平台,用于解决分布式系统中的任务调度和管理问题,文章详细介绍了XXL-JOB的架构,包括调度中心、执行器和Web... 目录一、xxl-job是什么二、使用步骤1. 下载并运行管理端代码2. 访问管理页面,确认是否启动成功

Mysql 中的多表连接和连接类型详解

《Mysql中的多表连接和连接类型详解》这篇文章详细介绍了MySQL中的多表连接及其各种类型,包括内连接、左连接、右连接、全外连接、自连接和交叉连接,通过这些连接方式,可以将分散在不同表中的相关数据... 目录什么是多表连接?1. 内连接(INNER JOIN)2. 左连接(LEFT JOIN 或 LEFT

使用Nginx来共享文件的详细教程

《使用Nginx来共享文件的详细教程》有时我们想共享电脑上的某些文件,一个比较方便的做法是,开一个HTTP服务,指向文件所在的目录,这次我们用nginx来实现这个需求,本文将通过代码示例一步步教你使用... 在本教程中,我们将向您展示如何使用开源 Web 服务器 Nginx 设置文件共享服务器步骤 0 —

Java中switch-case结构的使用方法举例详解

《Java中switch-case结构的使用方法举例详解》:本文主要介绍Java中switch-case结构使用的相关资料,switch-case结构是Java中处理多个分支条件的一种有效方式,它... 目录前言一、switch-case结构的基本语法二、使用示例三、注意事项四、总结前言对于Java初学者