随笔分类 -  Oracle

摘要:1. base64 的解密函数select utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw('dGVzdA=='))) from dual2. base64 的加密函数select utl_raw.cast_... 阅读全文
posted @ 2015-09-28 17:39 princessd8251 阅读(2992) 评论(0) 推荐(0)
摘要:SQL> Select CONCAT(TO_CHAR('0.001'*100,'990.99'),'%') FROM DUAL;CONCAT(TO_CHAR('----------------0.10%SQL> select to_char(1234567.89,'9,999,999.99') id... 阅读全文
posted @ 2015-03-09 20:59 princessd8251 阅读(1254) 评论(0) 推荐(0)
摘要:下面的两个SQL是等价的,但是一个执行N小时都执行不完,一个花了一分钟。执行计划显示第一个语句是由外面的即将被更新的表驱动内层,相对于是一个NEST LOOP,cost非常大。第二个语句是内层单独执行完后,与外面的筛选结果做一个HASH JOIN, cost降低了很多.UPDATE GPCOMP1.... 阅读全文
posted @ 2015-01-23 15:51 princessd8251 阅读(329) 评论(0) 推荐(0)
摘要:SELECT * FROM DBA_HIST_SQLBIND WHERE SNAP_ID>67073 AND SNAP_IDSELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ2 FROM SYS.x$ksppi x, SYS.x$... 阅读全文
posted @ 2015-01-08 15:41 princessd8251 阅读(4970) 评论(0) 推荐(0)
摘要:转自http://blog.csdn.net/pan_tian/article/details/7675800这段时间遇到一个问题,程序里明明插入了一条记录,但在后边的一段Procedure中却查不到刚刚插入的记录,最后发现这个Procedure的定义中加入了PRAGMA AUTONOMOUS_TR... 阅读全文
posted @ 2014-12-31 14:36 princessd8251 阅读(3948) 评论(0) 推荐(1)
摘要:SQL> select event#,name,parameter1,parameter2,parameter3 from v$event_name where name = 'db file parallel read'; EVENT# NAME ... 阅读全文
posted @ 2014-11-20 14:45 princessd8251 阅读(2458) 评论(0) 推荐(0)
摘要:From Metalink:Problem Description:====================When your server is not connected to the network and you try to connect inServer Manager (svrmgr... 阅读全文
posted @ 2014-11-02 15:34 princessd8251 阅读(1479) 评论(0) 推荐(0)
摘要:connect by中的条件就表示了父子之间的连接关系 比如 connect by id=prior pid,但如果connect by中的条件没有表示记录之间的父子关系那会出现什么情况?常见的,connect by会在构造序列的时候使用select rownum from dual connect... 阅读全文
posted @ 2014-10-31 01:36 princessd8251 阅读(20211) 评论(0) 推荐(1)
摘要:起始地 目的地 距离(公里)A B 1000A C 1100A D 900A E 400B D 300D F 600E A 400F G 1000C B 600请用SQL语句或一段代码写出从A出发,可达到的目的地(包括间接方式)。create table dest(sid char(1),eid c... 阅读全文
posted @ 2014-10-29 01:08 princessd8251 阅读(5369) 评论(0) 推荐(0)
摘要:数据泵卸载Oracle9i引入了外部表,作为向数据库中读取数据的一种方法.Oracle 10g则从另一个方向引入了这个特性,可以使用CREATE TABLE语句创建外部数据,从而由数据库卸载数据.从Oracle 10g起,这个数据从一种专用二进制格式抽取,这种格式称为数据 泵格式(Data Pump... 阅读全文
posted @ 2014-09-20 23:54 princessd8251 阅读(464) 评论(0) 推荐(0)
摘要:在v$session视图中有四个字段,如下:Wait information in v$session viewROW_WAIT_OBJ#NUMBERObject ID for the table containing the row specified in ROW_WAIT_ROW#ROW_WA... 阅读全文
posted @ 2014-09-20 23:21 princessd8251 阅读(872) 评论(0) 推荐(0)
摘要:Oracle:方法一:通过To_Number 函数异常来判断,因为这个函数在转换不成功的时候是报错,所以只能用存储过程包装起来.CREATE OR REPLACE FUNCTION Is_Number ( str_ VARCHAR2 ) RETURN VARCHAR2IS num_ NUMBER;B... 阅读全文
posted @ 2014-08-27 20:47 princessd8251 阅读(13303) 评论(0) 推荐(0)
摘要:SQLPlus directive "WHENEVER SQLERROR EXIT 1" will return a specified code when any SQL error throwed when run a sql file.Then we can catch the return ... 阅读全文
posted @ 2014-08-18 16:03 princessd8251 阅读(840) 评论(0) 推荐(0)
摘要:SQL> drop table test purge;SQL> create table test (id int,comments CLOB);SQL> select INDEX_NAME, INDEX_TYPE,TABLE_OWNER ,TABLE_NAME from user_indexes ... 阅读全文
posted @ 2014-08-10 18:24 princessd8251 阅读(892) 评论(0) 推荐(0)
摘要:For PL/SQL1)Create Directory Where BLOB resides.create or replace directory temp as '/oradata2'; -- if the directory name you created not qoted, then ... 阅读全文
posted @ 2014-07-31 21:47 princessd8251 阅读(1336) 评论(0) 推荐(0)
摘要:from https://jonathanlewis.wordpress.com/2011/08/29/deadlock-2/Here’s a deadlock graph the appeared on Oracle-L and OTN a couple of days ago.Deadlock ... 阅读全文
posted @ 2014-07-31 18:58 princessd8251 阅读(627) 评论(0) 推荐(0)
摘要:1. How does the invalid object come?The Oracle database will invalidate objects if a dependent object is changed. If I rebuild a table, the indexes on... 阅读全文
posted @ 2014-07-30 22:37 princessd8251 阅读(1026) 评论(0) 推荐(0)
摘要:十进制与十六进制的转换十进制-->十六进制select to_char(100,'XX') from dual;十六进制-->十进制select to_number('7D','XX') from dual; 阅读全文
posted @ 2014-07-30 21:27 princessd8251 阅读(331) 评论(0) 推荐(0)
摘要:Example to show the dead lock caused by lack of index on foreign key of child table.Session 1:create table p ( x int primary key );create table c ( x ... 阅读全文
posted @ 2014-07-30 20:36 princessd8251 阅读(818) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/liqfyiyi/article/details/7727641http://www.askmaclean.com/archives/category/oracle/lockhttp://database.51cto.com/art/201004/19729... 阅读全文
posted @ 2014-07-30 20:16 princessd8251 阅读(467) 评论(0) 推荐(0)