随笔分类 -  Oracle Utilities

1 2 3 下一页
Efficient Function Calls From SQL-在SQL语句中更高效的使用函数(转载)
摘要:网址:http://www.oracle-base.com/articles/misc/efficient-function-calls-from-sql.phpEfficient Function Calls From SQL对于在SQL中更加高效的使用PL/SQL函数,本文提供了以下几种解决办法: 1、标量子查询 2、使用DETERMINISTC(确定性的;命运注定论的)关键字 3、使用session缓存(在不同的session中也可以共用),该方法只在11g之后的版本可以使用 4、使用PL/SQL集合进行手动的控制缓存 5、使用上下文进行手动的控制缓存 6、注意在WHERE语... 阅读全文
posted @ 2012-12-04 07:31 Coldest Winter 阅读(349) 评论(0) 推荐(0)
注意事项:
摘要:1、by keeping them "independent" and then aggregating their aggregates -- we significantly decreased the amount of processing going on.在写统计个数的SQL语句的过程,我们最好,先把每个union all的子集的结果进行分别的汇总,然后,最终统一进行汇总,例如下面两个语句的写法:A:SELECT COUNT(*) FROM (SELECT NULL FROM test_explan UNION ALL SELECT ... 阅读全文
posted @ 2012-11-24 14:55 Coldest Winter 阅读(157) 评论(0) 推荐(0)
Efficient SQL Statements
摘要:声明:本文为转载,如果有侵犯知识版权,请通知本人,本人将即刻停止侵权行为:参考网址:http://www.oracle-base.com/articles/misc/efficient-sql-statements.php http://my.oschina.net/xianggao/blog/87216?from=20121111参考文档:Oracle Database Performance Tuning Guide, 10g Release 2 (10.2).pdf第11张SQL Tuning Overview的Developing Efficient SQL Statem... 阅读全文
posted @ 2012-11-18 11:38 Coldest Winter 阅读(365) 评论(0) 推荐(0)
Oracle operate XML in SQL
摘要:在SQL语句中,操作XML参考网址:http://www.oratechinfo.co.uk/sqlxml.html http://www.oratechinfo.co.uk/ 阅读全文
posted @ 2012-11-15 07:23 Coldest Winter 阅读(313) 评论(0) 推荐(0)
Oracle 分析函数
摘要:分析函数官方帮助文档:http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions001.htm#SQLRF06174一、Top-N Queries,row_number()参考网址:http://www.oracle-base.com/articles/misc/top-n-queries.php1、row_number() TheROW_NUMBERanalytic function is similar to theROWNUMpseudocolumn in that it assigns a unique number. 阅读全文
posted @ 2012-11-15 06:56 Coldest Winter 阅读(536) 评论(0) 推荐(0)
WM_CONCAT字符超过4000的处理办法
摘要:参考网址:http://stackoverflow.com/questions/11541383/ordering-by-list-of-strings-in-oracle-sql-without-listagg字符串拼接技巧和方式:http://www.oracle-base.com/articles/misc/string-aggregation-techniques.phphttp://www.williamrobertson.net/documents/one-row.html在进行使用WM_CONCAT或者自定义的聚合函数,进行拼串的时候,可能遇到拼串形成的结果集大于4000,这时候 阅读全文
posted @ 2012-11-13 22:23 Coldest Winter 阅读(2497) 评论(0) 推荐(1)
decode、sign、case在统计中的用法:
摘要:参考网址:http://www.skillbuilders.com/download/download-sample.cfm?course=adv-sql-queries&file=Adv%20SQL%20Queries%20for%20Oracle%2002%20Decode%20and%20CASE%20Notes.pdf说明:在统计中用到的MAX聚集函数也可以用sum、min、avg等其他聚集函数替代。用sign和decode来完成比较字段大小来区某个字段1 select decode(sign(字段1-字段2),-1,字段3,字段4) from dual;1、使用case进行直 阅读全文
posted @ 2012-11-11 13:32 Coldest Winter 阅读(435) 评论(0) 推荐(0)
数据分组取最大值行
摘要:数据分组取最大行:现有如下的业务:当前存在库房表,库房在每年都进行维护,每次维护后,会记录库房中商品的数量和维护的数量,在每年会不定期的进行维护:当前需要统计每年的库房中最新的信息:即最新月份的数据:如下所示表结构:1 SELECT t.*,2 t.rowid3 FROM stores t那么目前,需要求出的数据是2012-10、2011-06、2010-12三条数据,即根据年份分租找到其中最大的行记录:可以采用以下两种方式去实现:1、使用MAX()1 SELECT t.*,2 t.rowid3 FROM stores t4 WHERE t.tim... 阅读全文
posted @ 2012-11-07 22:19 Coldest Winter 阅读(352) 评论(0) 推荐(0)
Row generator
摘要:参考网址:http://www.orafaq.com/forum/mv/msg/95011/493456/102589/#msg_493456http://www.orafaq.com/forum/t/184746/170570/1、构造两个日期之间的时间:可以采用以下两种方式来实现:(1):1 SELECT to_date('2012-10-04', 'yyyy-mm-dd') - 1 + LEVEL2 FROM dual3 CONNECT BY LEVEL <= to_date('2012-11-04', 'yyyy-mm-dd 阅读全文
posted @ 2012-11-02 07:22 Coldest Winter 阅读(274) 评论(0) 推荐(0)
oracle script
摘要:http://www.orafaq.com/wiki/Scripts#General_SQL_Scriptshttp://www.sqlsnippets.com/en/topic-12021.html 阅读全文
posted @ 2012-10-29 07:41 Coldest Winter 阅读(135) 评论(0) 推荐(0)
存储过程包实例分享
摘要:1、网址:http://www.databasejournal.com/features/oracle/article.php/10893_3507806_2/A-View-of-Creating-an-Oracle-User---Part-I.htmView Code2、STR包:网址:http://www.joegarrepy.com/str_package.htm http://plnet.org/(包含很多使用的包)API参考手册:http://www.joegarrepy.com/pldoc_str.htmlView Code 1 CREATE OR REPLACE PACK... 阅读全文
posted @ 2012-09-22 09:29 Coldest Winter 阅读(230) 评论(0) 推荐(0)
为数据库的可恢复性作准备
摘要:参考:http://blog.csdn.net/robinson_0612/article/details/5784713 http://docs.oracle.com/cd/B13789_01/server.101/b10759/statements_2013.htm http://storage.chinaunix.net/stor/g/2008/07/21/1223005.shtml为了保证数据库的最大可恢复性, 1、必须多路复用控制文件; 2、必须多路复用联机重做日志; 3、必须以归档日志模式运行数据库,并多路复用归档日志文件; 最后必须做常规备份。一、保护控制... 阅读全文
posted @ 2012-07-22 11:00 Coldest Winter 阅读(522) 评论(0) 推荐(0)
恢复安装数据库的SCOTT用户的数据:
摘要:在进行Oracle学习的过程中,Oracle提供了一个非常强大的用户SCOTT。但是,在练习的过程中,我们可能会把SCOTT用户下的数据进行了修改,当要还原到初始的数据状态,可以使用Oracle 10g开始提供的一个非常强大的功能-闪回,也可以使用如下的脚本进行恢复用户初始数据,我也是无意中发现该语句:该语句需要在SQLPLUS下操作,或者把语句考出来执行亦可。执行的语句位于oracle_home\db_1\RDBMS\ADMIN\utlsampl.sql在PL/SQL developer的Command命令窗口或者在SQLPLUS中执行:由于该段命令最后有exit命令,所以会出现上述的断开。 阅读全文
posted @ 2012-07-07 21:46 Coldest Winter 阅读(424) 评论(0) 推荐(0)
彻底卸载Oracle(转载)
摘要:转载网址:http://www.cnblogs.com/xiaopeng84/archive/2008/12/22/1359750.htmloracle注册表删除--彻底卸载Oracle:用Oracle自带的卸载程序不能从根本上卸载Oracle,从而为下次的安装留下隐患,那么怎么才能完全卸载Oracle呢?那就是直接注册表清除,步骤如下:1、 开始->设置->控制面板->管理工具->服务停止所有Oracle服务。2、 开始->程序->Oracle - OraHome81->Oracle Installation Products->Univers 阅读全文
posted @ 2012-07-06 06:01 Coldest Winter 阅读(195) 评论(0) 推荐(0)
Oracle index(转载)
摘要:本文系转载,如果有侵犯只是版权,请联系本人,本人将即刻停止侵权行为参考网址:http://liusuper.iteye.com/blog/219013 http://blog.csdn.net/bobo12082119/article/details/6303875 :oracle 索引常用命令 http://blog.csdn.net/bobo12082119/article/details/6302773 :oracle 索引介绍 http://blog.csdn.net/tianlesoftware/article/details/5347098#comments... 阅读全文
posted @ 2012-06-25 07:44 Coldest Winter 阅读(285) 评论(0) 推荐(0)
Oracle 学习纲要
摘要:参考网址:http://www.eygle.com/archives/2008/10/oracle_dba_study_road.html 阅读全文
posted @ 2012-06-17 12:41 Coldest Winter 阅读(128) 评论(0) 推荐(0)
Using NULLs
摘要:Oracle中NULL的用法:参考网址:http://www.oratechinfo.co.uk/nulls.html#null_defUsing NULLsDefinition of NULLUsing NULL in a mathematical expression always returns NULLAppending NULL to a non-null string does not affect the stringAggregate functions tend to "ignore" NULLsGROUP BY treats NULL as a sepe 阅读全文
posted @ 2012-06-08 07:25 Coldest Winter 阅读(336) 评论(0) 推荐(0)
找回被create or replace覆盖的PL/SQL对象
摘要:参考网址:http://www.oracledatabase12g.com/ 在开发的过程中,可能由于某些程序员执行了create or replace方法,覆盖了之前的同名的PL/SQL对象或者是视图等。 这里需要使用到Oracle的新版本提供的闪回的功能-FLASHBACK QUERY.1、查询当前的SCN1 SELECT Dbms_Flashback.Get_System_Change_Number, Current_Scn FROM V$database2、查询系统中最小的SCN号(当前系统支持的)1 SELECT min(SCN) FROM sys.Smon_Scn_Time... 阅读全文
posted @ 2012-05-27 14:30 Coldest Winter 阅读(605) 评论(0) 推荐(0)
Oracle Calendar
摘要:声明: 本文为转载,如果有侵犯知识版本,请通知本人,本人将即刻停止侵权行为:参考网址:http://code.geekinterview.com/oracle/oracle-calendar-sql.html 1 SELECT Initcap(TRIM(To_Char(Dat, 'month'))) || ', ' || 2 To_Char(SYSDATE, 'yyyy') MONTH, 3 MAX(Decode(To_Char(Dat, 'd'), 2, To_Char(Dat, 'dd'))) Mon, 4 M 阅读全文
posted @ 2012-05-21 07:28 Coldest Winter 阅读(288) 评论(0) 推荐(0)
Converting delimited lists to collections (and vice versa)
只有注册用户登录后才能阅读该文。
posted @ 2012-05-20 09:47 Coldest Winter 阅读(23) 评论(0) 推荐(0)

1 2 3 下一页