SQL优化中索引列使用函数之灵异事件

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/lihuarongaini/article/details/99173747

在SQL优化内容中有一种说法说的是避免在索引列上使用函数、运算等操作,否则Oracle优化器将不使用索引而使用全表扫描,但是也有一些例外的情况,今天我们就来看看该灵异事件。

 

 

一般而言,以下情况都会使Oracle的优化器走全表扫描,举例:

 

1.         substr(hbs_bh,1,4)=’5400’,优化处理:hbs_bh like ‘5400%’

2.         trunc(sk_rq)=trunc(sysdate), 优化处理:sk_rq>=trunc(sysdate) and sk_rq

3.         进行了显式或隐式的运算的字段不能进行索引,如:

ss_df+20>50,优化处理:ss_df>30

'X' || hbs_bh>’X5400021452’,优化处理:hbs_bh>'5400021542'

 sk_rq+5=sysdate,优化处理:sk_rq=sysdate-5 

4.         条件内包括了多个本表的字段运算时不能进行索引,如:ys_df>cx_df,无法进行优化

qc_bh || kh_bh='5400250000',优化处理:qc_bh='5400' and kh_bh='250000'

5.  避免出现隐式类型转化

hbs_bh=5401002554,优化处理:hbs_bh='5401002554',注:此条件对hbs_bh 进行隐式的to_number转换,因为hbs_bh字段是字符型。

 

有一些其它的例外情况,如果select 后边只有索引列且where查询中的索引列含有非空约束的时候,以上规则不适用,如下示例:

 

先给出所有脚本及结论:

drop table t  purge;

Create Table t  nologging As select *  from    dba_objects d ;

create   index ind_objectname on  t(object_name); 

 

select t.object_name from t where t.object_name ='T';        --走索引

select t.object_name from t where UPPER(t.object_name) ='T';       --不走索引

select t.object_name from t where UPPER(t.object_name) ='T' and t.object_name IS NOT NULL ;           --走索引  (INDEX FAST FULL SCAN)

select t.object_name from t where UPPER(t.object_name) ||'AAA' ='T'||'AAA' and t.object_name IS NOT NULL ;     --走索引 (INDEX FAST FULL SCAN)

select t.object_name,t.owner from t where UPPER(t.object_name) ||'AAA' ='T'||'AAA' and t.object_name IS NOT NULL ;     --不走索引

 

 

测试代码:

C:\Users\华荣>sqlplus lhr/lhr@orclasm

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 11月 12 10:52:29 2014

 

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

 

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SQL>

SQL>

SQL> drop table t  purge;

 

表已删除。

 

SQL> Create Table t  nologging As select *  from    dba_objects d ;

 

表已创建。

 

SQL>  create   index ind_objectname on  t(object_name);

 

索引已创建。

 

 

---- t表所有列均可以为空

 

SQL> desc t

 Name                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 OWNER                               VARCHAR2(30)

 OBJECT_NAME                         VARCHAR2(128)

 SUBOBJECT_NAME                      VARCHAR2(30)

 OBJECT_ID                           NUMBER

 DATA_OBJECT_ID                      NUMBER

 OBJECT_TYPE                         VARCHAR2(19)

 CREATED                             DATE

 LAST_DDL_TIME                       DATE

 TIMESTAMP                           VARCHAR2(19)

 STATUS                              VARCHAR2(7)

 TEMPORARY                           VARCHAR2(1)

 GENERATED                           VARCHAR2(1)

 SECONDARY                           VARCHAR2(1)

 NAMESPACE                           NUMBER

 EDITION_NAME                        VARCHAR2(30)

 

SQL>

 

SQL>  set autotrace traceonly;

SQL>  select t.object_name from t where t.object_name ='T';

 

 

执行计划

----------------------------------------------------------

Plan hash value: 4280870634

 

-----------------------------------------------------------------------------------

| Id  | Operation        | Name           | Rows  | Bytes | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                |     1 |    66 |     3   (0)| 00:00:01 |

|*  1 |  INDEX RANGE SCAN| IND_OBJECTNAME |     1 |    66 |     3   (0)| 00:00:01 |

-----------------------------------------------------------------------------------

 

Predicate Information (identified by operation id):

---------------------------------------------------

 

   1 - access("T"."OBJECT_NAME"='T')

 

Note

-----

   - dynamic sampling used for this statement (level=2)

   - SQL plan baseline "SQL_PLAN_503ygb00mbj6k165e82cd" used for this statement

 

 

统计信息

----------------------------------------------------------

         34  recursive calls

         43  db block gets

        127  consistent gets

        398  physical reads

      15476  redo size

        349  bytes sent via SQL*Net to client

        359  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL>  select t.object_name from t where UPPER(t.object_name) ='T';

 

 

执行计划

----------------------------------------------------------

Plan hash value: 1601196873

 

--------------------------------------------------------------------------

| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |

--------------------------------------------------------------------------

|   0 | SELECT STATEMENT  |      |    12 |   792 |   305   (1)| 00:00:04 |

|*  1 |  TABLE ACCESS FULL| T    |    12 |   792 |   305   (1)| 00:00:04 |

--------------------------------------------------------------------------

 

Predicate Information (identified by operation id):

---------------------------------------------------

 

   1 - filter(UPPER("T"."OBJECT_NAME")='T')

 

Note

-----

   - dynamic sampling used for this statement (level=2)

   - SQL plan baseline "SQL_PLAN_9p76pys5gdb2b94ecae5c" used for this statement

 

 

统计信息

----------------------------------------------------------

         29  recursive calls

         43  db block gets

       1209  consistent gets

       1092  physical reads

      15484  redo size

        349  bytes sent via SQL*Net to client

        359  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL>  select t.object_name from t where UPPER(t.object_name) ='T' and t.object_name IS NOT NULL ;

 

 

执行计划

----------------------------------------------------------

Plan hash value: 3379870158

 

---------------------------------------------------------------------------------------

| Id  | Operation            | Name           | Rows  | Bytes | Cost (%CPU)| Time     |

---------------------------------------------------------------------------------------

|   0 | SELECT STATEMENT     |                |    51 |  3366 |   110   (1)| 00:00:02 |

|*  1 |  INDEX FAST FULL SCAN| IND_OBJECTNAME |    51 |  3366 |   110   (1)| 00:00:02 |

---------------------------------------------------------------------------------------

 

Predicate Information (identified by operation id):

---------------------------------------------------

 

   1 - filter("T"."OBJECT_NAME" IS NOT NULL AND UPPER("T"."OBJECT_NAME")='T')

 

Note

-----

   - dynamic sampling used for this statement (level=2)

   - SQL plan baseline "SQL_PLAN_czkarb71kthws18b0c28f" used for this statement

 

 

统计信息

----------------------------------------------------------

         29  recursive calls

         43  db block gets

        505  consistent gets

        384  physical reads

      15612  redo size

        349  bytes sent via SQL*Net to client

        359  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL>  select t.object_name,t.owner from t where UPPER(t.object_name) ||'AAA' ='T'||'AAA' and t.object_name IS NOT NULL ;

 

 

执行计划

----------------------------------------------------------

Plan hash value: 1601196873

 

--------------------------------------------------------------------------

| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |

--------------------------------------------------------------------------

|   0 | SELECT STATEMENT  |      |    51 |  4233 |   304   (1)| 00:00:04 |

|*  1 |  TABLE ACCESS FULL| T    |    51 |  4233 |   304   (1)| 00:00:04 |

--------------------------------------------------------------------------

 

Predicate Information (identified by operation id):

---------------------------------------------------

 

   1 - filter("T"."OBJECT_NAME" IS NOT NULL AND

              UPPER("T"."OBJECT_NAME")||'AAA'='TAAA')

 

Note

-----

   - dynamic sampling used for this statement (level=2)

   - SQL plan baseline "SQL_PLAN_au9a1c4hwdtb894ecae5c" used for this statement

 

 

统计信息

----------------------------------------------------------

         30  recursive calls

         44  db block gets

       1210  consistent gets

       1091  physical reads

      15748  redo size

        408  bytes sent via SQL*Net to client

        359  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL> select t.object_name from t where UPPER(t.object_name) ||'AAA' ='T'||'AAA' and t.object_name IS NOT NULL ;

 

 

执行计划

----------------------------------------------------------

Plan hash value: 3379870158

 

---------------------------------------------------------------------------------------

| Id  | Operation            | Name           | Rows  | Bytes | Cost (%CPU)| Time     |

---------------------------------------------------------------------------------------

|   0 | SELECT STATEMENT     |                |    51 |  3366 |   110   (1)| 00:00:02 |

|*  1 |  INDEX FAST FULL SCAN| IND_OBJECTNAME |    51 |  3366 |   110   (1)| 00:00:02 |

---------------------------------------------------------------------------------------

 

Predicate Information (identified by operation id):

---------------------------------------------------

 

   1 - filter("T"."OBJECT_NAME" IS NOT NULL AND

              UPPER("T"."OBJECT_NAME")||'AAA'='TAAA')

 

Note

-----

   - dynamic sampling used for this statement (level=2)

   - SQL plan baseline "SQL_PLAN_1gu36rnh3s2a318b0c28f" used for this statement

 

 

统计信息

----------------------------------------------------------

         28  recursive calls

         44  db block gets

        505  consistent gets

          6  physical reads

      15544  redo size

        349  bytes sent via SQL*Net to client

        359  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed

 

SQL>

 

 

其实很好理解的,索引可以看成是小表,一般而言索引总是比表本身要小得多,如果select 后需要检索的项目在索引中就可以检索的到那么Oracle优化器为啥还去大表中寻找数据呢?

展开阅读全文

MY sql 灵异事件

03-29

是一个关于mysql的问题.语句如下:rn (SELECT n.nid,n.created,u.dst, NULL as tid FROM en_node n LEFT JOIN en_url_alias u ON n.nid = SUBSTRING(u.src, 6) ORDER BY n.created DESC LIMIT 20)rnrn en_node en_url_alias 数据量在900条左右,而查询此句sql,竟然花掉1.3秒之多.rn 去掉 ORDER BY n.created DESC ,时间是0.02左右.rn 总共查询出的结果就才20条,一个order by,为何花费这么多时间? rnrn 两个表的结构如下 :rnCREATE TABLE IF NOT EXISTS `en_node` (rn `nid` int(10) unsigned NOT NULL AUTO_INCREMENT,rn `vid` int(10) unsigned NOT NULL DEFAULT '0',rn `type` varchar(32) NOT NULL DEFAULT '',rn `language` varchar(12) NOT NULL DEFAULT '',rn `title` varchar(255) NOT NULL DEFAULT '',rn `uid` int(11) NOT NULL DEFAULT '0',rn `status` int(11) NOT NULL DEFAULT '1',rn `created` int(11) NOT NULL DEFAULT '0',rn `changed` int(11) NOT NULL DEFAULT '0',rn `comment` int(11) NOT NULL DEFAULT '0',rn `promote` int(11) NOT NULL DEFAULT '0',rn `moderate` int(11) NOT NULL DEFAULT '0',rn `sticky` int(11) NOT NULL DEFAULT '0',rn `tnid` int(10) unsigned NOT NULL DEFAULT '0',rn `translate` int(11) NOT NULL DEFAULT '0',rn PRIMARY KEY (`nid`),rn UNIQUE KEY `vid` (`vid`),rn KEY `node_changed` (`changed`),rn KEY `node_created` (`created`),rn KEY `node_moderate` (`moderate`),rn KEY `node_promote_status` (`promote`,`status`),rn KEY `node_status_type` (`status`,`type`,`nid`),rn KEY `node_title_type` (`title`,`type`(4)),rn KEY `node_type` (`type`(4)),rn KEY `uid` (`uid`),rn KEY `tnid` (`tnid`),rn KEY `translate` (`translate`)rn) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1133 ;rnrnrnrnCREATE TABLE IF NOT EXISTS `en_url_alias` (rn `pid` int(10) unsigned NOT NULL AUTO_INCREMENT,rn `src` varchar(128) NOT NULL DEFAULT '',rn `dst` varchar(128) NOT NULL DEFAULT '',rn `language` varchar(12) NOT NULL DEFAULT '',rn PRIMARY KEY (`pid`),rn UNIQUE KEY `dst_language_pid` (`dst`,`language`,`pid`),rn KEY `src_language_pid` (`src`,`language`,`pid`)rn) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=886 ;rnrn请高人指点,本语句该如何优化? rn 论坛

关于sql优化——索引使用

01-29

有一个视图如下:rnSelect a.WKI_ID AS wf_workitem_id, rn a.WKI_Name AS wf_workitem_name, j.user_name as wf_from_user_name,rn a.WKI_CreateTime AS wf_create_date,a.wki_checkintime as wf_checkin_date, a.WKI_Desc AS wf_workitem_url,rn a.wki_state,a.wki_user,a.wki_checkouttime,rn c.PRI_ID AS wf_process_instance_id,rn d.wka_applyman,rn g.BUSINESS_ID AS wf_business_id,rn g.PROJECT_ID AS wf_project_id,rn h.PRJ_TITLE AS wf_project_title,rn h.PRJ_BUSS_TYPE AS wf_business_type,rn h.PRJ_BUSS_NAME AS wf_business_name, k.TIME_LIMIT AS wf_workitem_timelimit,rn k.TIME_USED AS wf_workitem_timeused, k.TIME_LEFT AS wf_workitem_timeleft, rn e.atd_id,e.atd_tamidrn l.act_max_timeoutrn ,decode((select count(*) from wf_workitem_urge m where m.wki_id=a.wki_id),0,'no') as ifHaveUrgernFROM WorkItem a rn INNER JOIN ActiInstance b ON a.WKI_AtiID = b.ATI_IDrn INNER JOIN ProcInstance c ON b.ATI_PriID = c.PRI_IDrn INNER JOIN WF_PROCESS_BUSINESS_REL g ON c.PRI_ID = g.PRO_INST_IDrn INNER JOIN WF_PUBLIC_PROJECT_INFO h ON g.PROJECT_ID = h.PROJECT_IDrn INNER JOIN ProcDefinition f ON f.PRD_ID = c.PRI_PrdIDrn LEFT OUTER JOIN WorkitemApply d ON a.WKI_ID = d.WKA_WkiIDrn INNER JOIN ActiDefinition e ON b.ATI_AtdID = e.ATD_ID rn LEFT OUTER JOIN WF_WORKITEM_REL i ON a.WKI_ID = i.TO_ITEM_IDrn LEFT OUTER JOIN WF_USER j ON j.USER_ID = i.FROM_USER_IDrn INNER JOIN WF_WORKITEM_PROCESS_TIME k ON a.WKI_ID = k.WORKITEM_IDrn LEFT JOIN wf_actinstance_ext l On b.ATI_ID = l.act_instance_idrn INNER JOIN workitemreledata m on a.wki_id = m.WKR_WKIID rnwhere m.WKR_VARIABLENAME='isNeedSignIn' and m.WKR_NUMBVALUE!=1rnrn其中,oracle执行计划如下:rnSELECT STATEMENT, GOAL = CHOOSE Cost=206 Cardinality=302 Bytes=208078rn HASH JOIN Cost=206 Cardinality=302 Bytes=208078rn NESTED LOOPS Cost=187 Cardinality=302 Bytes=200226rn NESTED LOOPS Cost=144 Cardinality=43 Bytes=21672rn HASH JOIN Cost=144 Cardinality=43 Bytes=21113rn HASH JOIN Cost=141 Cardinality=43 Bytes=19049rn HASH JOIN OUTER Cost=133 Cardinality=43 Bytes=17931rn NESTED LOOPS Cost=130 Cardinality=43 Bytes=16985rn NESTED LOOPS OUTER Cost=102 Cardinality=28 Bytes=9968rn HASH JOIN OUTER Cost=82 Cardinality=20 Bytes=6540rn HASH JOIN Cost=77 Cardinality=20 Bytes=6140rn HASH JOIN OUTER Cost=73 Cardinality=20 Bytes=5100rn NESTED LOOPS Cost=69 Cardinality=20 Bytes=4500rn TABLE ACCESS FULL Object owner=YZH Object name=WORKITEMRELEDATA Cost=49 Cardinality=20 Bytes=1060rn TABLE ACCESS BY INDEX ROWID Object owner=YZH Object name=WORKITEM Cost=1 Cardinality=1 Bytes=172rn INDEX UNIQUE SCAN Object owner=YZH Object name=PK_WORKITEM Cardinality=1 rn TABLE ACCESS FULL Object owner=YZH Object name=WORKITEMAPPLY Cost=3 Cardinality=1062 Bytes=31860rn TABLE ACCESS FULL Object owner=YZH Object name=WF_WORKITEM_PROCESS_TIME Cost=3 Cardinality=1062 Bytes=55224rn INDEX FAST FULL SCAN Object owner=YZH Object name=PK_WORKITEM_REL Cost=4 Cardinality=1634 Bytes=32680rn TABLE ACCESS BY INDEX ROWID Object owner=YZH Object name=WF_USER Cost=1 Cardinality=1 Bytes=29rn INDEX UNIQUE SCAN Object owner=YZH Object name=PK_WF_USER Cardinality=1 rn TABLE ACCESS BY INDEX ROWID Object owner=YZH Object name=ACTIINSTANCE Cost=1 Cardinality=2 Bytes=78rn INDEX UNIQUE SCAN Object owner=YZH Object name=PK_ACTIINSTANCE Cardinality=1 rn TABLE ACCESS FULL Object owner=YZH Object name=WF_ACTINSTANCE_EXT Cost=2 Cardinality=409 Bytes=8998rn TABLE ACCESS FULL Object owner=YZH Object name=PROCINSTANCE Cost=7 Cardinality=4738 Bytes=123188rn TABLE ACCESS FULL Object owner=YZH Object name=WF_PROCESS_BUSINESS_REL Cost=2 Cardinality=409 Bytes=19632rn INDEX UNIQUE SCAN Object owner=YZH Object name=PK_PROCDEFINITION Cardinality=1 Bytes=13rn TABLE ACCESS BY INDEX ROWID Object owner=YZH Object name=WF_PUBLIC_PROJECT_INFO Cost=1 Cardinality=7 Bytes=1113rn INDEX UNIQUE SCAN Object owner=YZH Object name=PK_WF_PUBLIC_PROJECT_INFO Cardinality=1 rn TABLE ACCESS FULL Object owner=YZH Object name=ACTIDEFINITION Cost=12 Cardinality=8414 Bytes=218764rnrn现在问题是,我的c.PRI_ID 和 g.PRO_INST_ID都是主键,为什么PROCINSTANCE表会造成全表查询?还有我的e.atd_id也是主键,为什么ACTIDEFINITION表也会造成全表查询?我把e.atd_tamid这个字段去掉就不会使用全表查询而使用索引了。 论坛

索引 SQL语句优化

05-09

麻烦各位大哥了! 现声明:我对ORALCE一窍不通,只停留在PL/SQL中写写Select语句,因为语句效率太低,疑似运行是会导致锁表,所以有人建议多用索引,貌似先在Explain Plan Window 中运行检查什么.......rn 我的问题来了:1、Select语句超时运行会导致锁表,用索引优化是做好的方式吗?或者说不用索引还有其他的优化方式吗?rn 2、怎么使用索引(没用过),是否先要检查现在的Orlace中现有的索引哪些可用?怎样看现有的索引?rn 3、怎样新建索引,建立要遵循什么原则rn 4、写Select 语句是怎样调用索引rn 5、Explain Plan Window的作用,怎么用?rnrn附件:下面是我用到一个查询语句、大家可以作为例子给个解答,不胜感激,谢谢啦!!rn [code=SQL]SELECT DRDL01,rn MCDL01,rn IMDSC1,rn ILDOC,rn ILTRDJ,rn IOLOT1,rn ILMCU,rn IOLOT2,rn ILPAID,rn ILTRUM,rn ILTRQT,rn ILUNCS,rn IORLOTrn FROM (select * from PRODDTA.F4111rn WHERE ILDCT = 'FG' and TRIM(F4111.ILFRTO) = 'F'rn AND ILKCO NOT IN ('02500', '05100', '05200', '06000', '06100', '08000')rn AND (1=1)) F4111rn LEFT OUTER JOIN (SELECT *rn FROM PRODDTA.F0006rn INNER JOIN PRODCTL.F0005 rn ON TRIM(PRODCTL.F0005.DRKY) = TRIM(PRODDTA.F0006.MCRP01)rn AND PRODCTL.F0005.DRSY = '00'rn AND PRODCTL.F0005.DRRT = '01') A rn ON trim(F4111.ILMCU) = trim(A.MCMCU)rn LEFT OUTER JOIN PRODDTA.F4101 ON PRODDTA.F4101.IMITM = F4111.ILITMrn LEFT OUTER JOIN PRODDTA.F4102 ON PRODDTA.F4102.IBITM = F4111.ILITMrn AND trim(PRODDTA.F4102.IBMCU) = trim(F4111.ILMCU)rn LEFT OUTER JOIN PRODDTA.F4108 ON PRODDTA.F4108.IOLITM =rn F4111.ILLITMrn AND trim(PRODDTA.F4108.IOLOTN) = trim(F4111.ILLOTN)rn AND trim(PRODDTA.F4108.IOMCU) = trim(F4111.ILMCU)[/code] 论坛

灵异事件,求真相。。。

05-13

自学C Primer中,看书做题刚到第7章,然后练习题里有这样一个题目rnrn要求输出一个句子,遇到'#'结束,然后把句子中的'.'(句号)替换为'!'(感叹号),把'!'(感叹号)替换为'!!'(感叹号X2),然后输出替换后的句子rnrn[code=c]rn#includern#includernconst char Stop = '#';rnconst char Symbol_1 = '.';rnconst char Symbol_2 = '!';rnconst int MaxLen = 100;rnint main(void)rnrn char chs[MaxLen];rn char Letter;rn int Counts = 0;rn int Times = 0;rn printf("Please Input Words To Test:\n");rn while((Letter = getchar()) != Stop)rn rn if(Letter == Symbol_1)rn rn chs[Counts] = Symbol_2;rn ++Counts;rn ++Times;rn rn elsern if(Letter == Symbol_2)rn rn chs[Counts] = Symbol_2;rn chs[Counts+1] = Symbol_2;rn Counts += 2;rn ++Times;rn rn elsern rn chs[Counts] = Letter;rn ++Counts;rn rn rn printf("%d Times\n",Times);rn printf("%s\n",chs); //<----这个很奇葩rn// int Len = strlen(chs); //<---问题出在这3行代码里rn// for(int i = 0 ; i < Len+1 ; ++i)rn// printf("%c ",chs[i]);rn return 0;rnrn[/code]rn本来我写好代码(开始没加那3行代码),编译运行后出现一个问题,比如我输入'qwqw..!!#qw'rn然后替换次数为4次,这没问题,但最后用printf()显示替换后的字符串,正确的结果应该是qwqw!!!!!!rn但在我的系统(ubuntukylin14.04)里结果是rnqwqw!!!!!!D rn字符串后面莫名其妙的多了2个不知道是什么东东。。。[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/19.gif][/img]rn然后我为了确认下这2个奇葩到底是什么,所以就在代码上加了那3行,我本来想着一个一个的输出,看看最后2个字符到底是什么,rnrn结果。。。。编译完成后运行程序,我发现程序好了。。。[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/18.gif][/img]rn这时候我在输入'qwqw..!!#qw'rn结果为rnqwqw!!!!!!! <----最关键的是我想知道为什么这行也正常了。。。。rnq w q w ! ! ! ! ! ! ! rn 论坛

没有更多推荐了,返回首页