如何删除oracle统计信息,delete statistics 删除统计信息

今天一个sql语句很奇怪,统计信息以后,表竟然走全表扫描。后来没有办法我只得删除统计信息。

exec dbms_stats.delete_table_stats('missh','cancel_orderln');

删除统计信息很容易:两个参数表的“宿主”,和“表名”,两个参数都用单引号''

sql具体语句如下:

SELECT

ORDDATE,

A.ORDNO,

STOCKNO,

CUST_CODE,

CUST_NAME,

A.MEMO,

PROPERTY_CODE,

TYPE_CODE,

REGION_CODE,

DEPT_NO,

EMP_NAME,

DELIVERY_ADD,

LINKMAN,

PACKAGE,

PRO_CODE,

PRO_NAME,

PRO_SPEC,

BRAND_CODE,

WAREHOUSE,

PLACE,

QUANTITY,

OR_PRICE,

PRICE_QUOTA,

UNIT_PRICE,

SUM1,

B.MEMO MEMO_L,

SMALLTYPE_CODE,

PMY_TYPE,

AGIO_SUM,

BIGTYPE_CODE,

WARRANT,

A.ENDDATE,

B.LN_ACCOUNT

FROM missh.V_ORDERHD A,missh.V_ORDERLN B

WHERE A.CORPID = :b1

AND B.CORPID = A.CORPID

AND B.ORDNO = A.ORDNO

AND A.ORDDATE

BETWEEN NVL(TO_DATE(TO_CHAR(:b2,'yyyymmdd'),'yyyymmdd'),A.ORDDATE)

AND NVL(TO_DATE(TO_CHAR(:b3,'yyyymmdd') || ':23:59:59'

,'YYYYMMDD:Hh24:MI:SS'),A.ORDDATE)

AND NVL(REGION_CODE,'X')

BETWEEN NVL(:b4,NVL(REGION_CODE,'X'))

AND NVL(:b5,NVL(REGION_CODE,'X'))

AND NVL(CUST_CODE,'X')

BETWEEN NVL(:b6,NVL(CUST_CODE,'X'))

AND NVL(:b7,NVL(CUST_CODE,'X'))

AND NVL(DEPT_NO,'X')

BETWEEN NVL(:b8,NVL(DEPT_NO,'X'))

AND NVL(:b9,NVL(DEPT_NO,'X'))

AND NVL(EMP_NO,'X')

BETWEEN NVL(:b10,NVL(EMP_NO,'X'))

AND NVL(:b11,NVL(EMP_NO,'X'))

AND NVL(PACKAGE,'X') = NVL(:b12,NVL(PACKAGE,'X'))

AND NVL(SMALLTYPE_CODE,'X')

BETWEEN NVL(:b13,NVL(SMALLTYPE_CODE,'X'))

AND NVL(:b14,NVL(SMALLTYPE_CODE,'X'))

AND NVL(BIGTYPE_CODE,'X')

BETWEEN NVL(:b15,NVL(BIGTYPE_CODE,'X'))

AND NVL(:b16,NVL(BIGTYPE_CODE,'X'))

AND NVL(PRO_CODE,'X')

BETWEEN NVL(:b17,NVL(PRO_CODE,'X'))

AND NVL(:b18,NVL(PRO_CODE,'X'))

AND NVL(WAREHOUSE,'X')

BETWEEN NVL(:b19,NVL(WAREHOUSE,'X'))

AND NVL(:b20,NVL(WAREHOUSE,'X'))

AND NVL(BRAND_CODE,'X')

BETWEEN NVL(:b21,NVL(BRAND_CODE,'X'))

AND NVL(:b22,NVL(BRAND_CODE,'X'))

AND STATUS_IN = 'Y'

ORDER BY A.ORDNO[@more@]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值