上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 30 下一页

2014年4月17日

一段关于python 闭包的例子

摘要: >>> def counter(a=0):... count = a... def incr():... b = 1 + count... return b... return incr...>>> count = counte... 阅读全文

posted @ 2014-04-17 17:51 kramer 阅读(342) 评论(0) 推荐(0) 编辑

2014年4月10日

ddl in PL/SQL

摘要: If you write DDL directly in PL/SQL. You will hit error. 1 DECLARE 2 str_sql varchar2(500); 3 begin 4 create table test (id number); 5 end; 6 / create table test (id number); *ERROR at line 4:ORA-06550: line 4, column 2:PLS-00103: Encountered the symbol "CREATE" when ... 阅读全文

posted @ 2014-04-10 12:07 kramer 阅读(224) 评论(0) 推荐(0) 编辑

2014年4月3日

python lambda函数

摘要: 首先说一下什么是lambda函数。 lambda函数是python中的一种定义函数的方法(当然在很多其它语言中,比如lisp也有)。通过lambda定义的函数,没有函数名。比如下面的代码:>>> lambda x: x*x at 0x2ae456263938>这段lambda代码只是返回了一个函数对象的指针(姑且这么理解吧)。 lambda 后面跟的是该函数的参数列表,这里是一个 x. 而 " : " 后面跟的是函数体。 这一段代码的意识是创建一个函数,该函数接受一个参数并返回其平方。 这段代码创建了一个函数对象后,这个函数对象没有被任何人引用,所以 阅读全文

posted @ 2014-04-03 14:35 kramer 阅读(569) 评论(0) 推荐(0) 编辑

python map函数

摘要: python的map函数官方说明如下:>>> help(map)Help on built-in function map in module __builtin__:map(...) map(function, sequence[, sequence, ...]) -> list Return a list of the results of applying the function to the items of the argument sequence(s). If more than one sequence is given, the function . 阅读全文

posted @ 2014-04-03 11:35 kramer 阅读(232) 评论(0) 推荐(0) 编辑

2014年4月2日

装饰器 转载自 http://www.cnblogs.com/huxi/archive/2011/03/01/1967600.html

摘要: 今天来讨论一下装饰器。装饰器是一个很著名的设计模式,经常被用于有切面需求的场景,较为经典的有插入日志、性能测试、事务处理等。装饰器是解决这类问题的绝佳设计,有了装饰器,我们就可以抽离出大量函数中与函数功能本身无关的雷同代码并继续重用。概括的讲,装饰器的作用就是为已经存在的对象添加额外的功能。1. 装饰器入门1.1. 需求是怎么来的?装饰器的定义很是抽象,我们来看一个小例子。1234deffoo():print'in foo()'foo()这是一个很无聊的函数没错。但是突然有一个更无聊的人,我们称呼他为B君,说我想看看执行这个函数用了多长时间,好吧,那么我们可以这样做:12345 阅读全文

posted @ 2014-04-02 10:22 kramer 阅读(180) 评论(0) 推荐(0) 编辑

2014年3月31日

no_merge hint

摘要: This is tested in 10gR2.SQL> select * from v$version;BANNER------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64biPL/SQL Release 10.2.0.5.0 - ProductionCORE 10.2.0.5.0 ProductionTNS for Solaris: Version 10.2.0.5.0 - ProductionNLSRTL Ve... 阅读全文

posted @ 2014-03-31 12:00 kramer 阅读(431) 评论(0) 推荐(0) 编辑

2014年3月18日

优化实例- not use hash to avoid temp space issue

摘要: 在展开下面的original sql 和 execution plan之前,要知道这个SQL的问题就在于占用大量的TEMP spaceorignal SQLSELECT roster.IC_N AS icN, roster.WORK_SHIFT_C AS workShiftC, roster.EXTRA_SHIFT_C AS extraShiftC, roster.GENERATED_SHIFT_C AS generatedShiftC, roster.RESERVE_SHIFT_C AS reserveShiftCode, num.STAFF_N AS staffN... 阅读全文

posted @ 2014-03-18 18:03 kramer 阅读(382) 评论(0) 推荐(0) 编辑

明日计划

摘要: 1. 看这篇blog(http://www.cnblogs.com/kramer/p/3608286.html) ,想办法用hash hint 完善original sql 。2. 看这篇blog (http://www.cnblogs.com/kramer/p/3608343.html),想办法用 hint 去unnest 以及弄明白 max 函数到底会不会导致unnest , max和count等是不是有区别,如果有为什么3. 看Cost Based Oracle Fundamentals-Jonathan Lewis.20064. 看subquery并总结 阅读全文

posted @ 2014-03-18 17:42 kramer 阅读(136) 评论(0) 推荐(0) 编辑

优化实例- not in 和 not exists

摘要: 客户运行一个SQL,非常慢。于是进行了一下改写。速度飞快,首先看一下原来的SQL。original sqlSQL> explain plan for 2 select count(*) from pnadmin.si_vsl where vsl_status_i = 'A' and to_number(vsl_id_n) not in (select vessel_id from pnadmin.vessel_master);Explained.SQL> select * from table(dbms_xplan.display());PLAN_TABLE_OUT 阅读全文

posted @ 2014-03-18 17:41 kramer 阅读(1469) 评论(0) 推荐(0) 编辑

2014年3月12日

insert into varchar2(8000)

摘要: 在看12c的文档的时候发现varcahr2最大长度是4000 byteVARCHAR2 Data TypeTheVARCHAR2data type specifies a variable-length character string. When you create aVARCHAR2column, you supply the maximum number of bytes or characters of data that it can hold. Oracle subsequently stores each value in the column exactly as you s 阅读全文

posted @ 2014-03-12 17:53 kramer 阅读(667) 评论(0) 推荐(0) 编辑

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 30 下一页

导航