自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(57)
  • 收藏
  • 关注

原创 oracle面向对象编程的多态性

--如果使用子类型初始化,则调用子类型函数SQL> create or replace type pt is object  2  (  3    name varchar2(20),  4    sex  varchar2(2),  5    age  number,  6    member procedure p_Set_Print,  7    member f

2016-03-08 01:49:43 686

原创 dbms_errlog.create_error_log

dbms_errlog.create_error_log(     dml_table_name          -- in varchar2   err_log_table_name      -- in varchar2  未指定时:err$_tablename   err_log_table_owner     -- in varchar2     err_log_ta

2016-03-04 23:06:38 1139

原创 listagg

语法:listagg(column_name[,split_character]) within group(order by column_name,...) [over(partition by column_name,...)]SQL> select listagg(ename) within group(order by rowid) as ename from emp ;

2016-03-04 23:01:23 383

原创 ratio_to_report

语法:ratio_to_report(exp) over([partition by column_name,...])SQL> create table TEST  2  (  3    姓名 VARCHAR2(20),  4    科目 VARCHAR2(20),  5    成绩 NUMBER  6  )  7  /Table createdSQL

2016-02-17 01:22:58 412

原创 删除嵌套表类型列的元素值

SQL> create or replace type nt is table of varchar2(20);  2  /Type createdSQL> create table tmp(id number,cont nt) nested table cont store as cont_tbl;Table createdSQL> insert into t

2016-02-15 16:23:18 379

原创 触发器事务

总结:不能在DML触发器、Instead of触发器、DDL触发器内直接使用提交事务或回滚事务的语句,但Database触发器可以1、DML触发器(Instead of)SQL> Create Table tmp_dml(str Varchar2(20));Table createdSQL> Create Table tmp_dml_log(str_log Varchar2(20)

2016-01-18 01:31:10 290

原创 least和greatest

Least:返回一组数的最小数,有null则返回nullSQL> Select Least(1,-1,2) From dual ;LEAST(1,-1,2)-------------           -1SQL> Select Least('b','dc') From dual ;LEAST('B','DC')---------------b

2016-01-18 01:29:10 595

原创 nocopy

in out nocopy 、out nocopy 引用传递in out 、out 副本传递 复制副本-->传入副本-->修改副本-->正常结束、传出副本                       复制副本-->传入副本-->修改副本-->不正常结束、不传出副本  SQL> declare  2    a number:=1;  3    procedure proc(a i

2016-01-18 01:07:30 331

原创 coalesce、nvl、nvl2比较

coalesce(操作数1,操作数2[,...,操作数N]) 1、返回coalesce操作数列表中第一个非null,如果多为null,则返回null2、在coalesce表达式中必须至少有一个操作数不为null3、nvl、nvl2先执行所有操作数再判断,coalesce先判断,只有在有必要时才执行操作数SQL> declare  2    a varchar2(20):

2016-01-17 15:19:35 2894

原创 隐式游标的属性值变化

SQL> begin  2    dbms_output.put_line('DML操作之前');  3    if sql%rowcount is null then  4       dbms_output.put_line('sql%rowcount is null');  5    end if;  6    if sql%isopen is null then 

2016-01-16 02:14:58 402

原创 forall

Forall 下标变量 In 下限..上限  一条Sql语句;Forall 下标变量 In Indices Of 集合 [Between 下限 And 上限]     --跳过没有赋值的元素  一条sql语句;Forall 下标变量 In Values Of 集合                              --将集合值作为下标  值类型为pls_integer |

2015-12-01 00:32:57 926

原创 游标在fetch过程中不允许更新自己

SQL> Declare  2    vname dept.dname%Type;  3  Begin  4    For csr In(Select * From dept For Update) Loop  5        Update dept Set dname=Upper(dname) Where deptno=csr.deptno Returning dname In

2015-11-30 01:32:44 437

原创 Continue

SQL> Declare  2    i Number;  3  Begin  4    >  5    For i In 1..10 Loop  6      Continue Outer When Mod(i,2)=0;  7      Exit Outer When i>6;  8      dbms_output.put_line(i);  9    End

2015-11-30 00:07:05 224

原创 sql%rowcount

1、没有执行过select、insert、update、delete sql%rowcount为null2、commit、rollback后  sql%rowcount为0SQL> Declare  2    Type t Is Table Of dept%Rowtype;  3    vt t;  4  Begin  5    If Sql%Rowcount Is Nul

2015-11-29 23:34:25 937

原创 case语句(未找到Case)

SQL> Declare  2    i Varchar2(20);  3  Begin  4    i:=Case 3  5       When 1 Then 1.1  6       When 2 Then 1.2  7       End;  8       If i Is Null Then  9         dbms_output.put_line(

2015-11-28 01:53:05 2866

原创 table(集合对象)

说明:table()必须使用schema级别的集合对象SQL> Declare  2    Type t_nstbl Is Table Of Varchar2(20);  --本地  3    v_nstbl t_nstbl;  4    csr Sys_Refcursor;  5    vlu Varchar2(20);  6  Begin  7    v_nstbl

2015-11-28 01:51:09 378

原创 DML语句的Returning...Into...

SQL> Declare  2    vID Number;  3    vNM Varchar2(20);  4    Type t_stu Is Table Of stu%Rowtype;  5    v_stu t_stu;  6    i Number;  7  Begin  8    dbms_output.put_line('*******insert***

2015-11-26 00:28:42 314

原创 bulk collect

SQL> set serverout onSQL> SQL> Declare  2    Cursor Csr Is Select Level From dual Connect By Level  3    Type T_Csr Is Table Of Varchar2(10);  4    v_Csr T_Csr;  5    i Number:=0;  6

2015-11-25 23:46:06 378

原创 <<Label_Name>>End Loop Label_Name;

语法:    [>]   Loop      Continue [Label_Name] ....      Exit  [Label_Name]...     --statement   End Loop [Label_Name];   [>]   For ... Loop      Continue [Label_Name] ....      Ex

2015-11-25 02:10:51 330

原创 SYS_REFCURSOR

1、使用SYS_REFCURSORSQL> Declare  2    Cur Sys_Refcursor;  3    R   scott.dept%Rowtype;  4  Begin  5    Open Cur For Select * From scott.dept;  6    Loop  7      Fetch Cur Into R;  8    

2015-11-24 00:26:16 741

原创 控制文件

1、查看控制文件SQL> show parameter control_files;NAME                                 TYPE        VALUE------------------------------------ ----------- ------------------------------control_files

2015-10-19 00:32:47 359

原创 autonomous_transaction

SQL> create table tmp(content varchar2(100));Table createdSQL> create or replace function autonomous_transaction_func  2  return varchar2  3  is  4    pragma autonomous_transaction;  5

2015-10-12 01:05:49 352

原创 imp

1、fromuser touser1.1C:\>imp 'system/manager@test as sysdba'  file=c:\full.dmp log=c:\full.log fromuser=scott,u1 touser=scott,u1Import: Release 11.2.0.1.0 - Production on 星期四 9月 10 22:2

2015-09-10 23:12:11 1485

原创 exp

1、owner1.1 C:\>exp scott/tiger@test owner=scott file=c:\scott1.dmp log=c:\scott1.logExport: Release 11.2.0.1.0 - Production on 星期四 9月 10 01:14:07 2015Copyright (c) 1982, 2009, Orac

2015-09-10 23:11:02 1515

原创 flashback

--1、闪回时间点查询--Select ...From Table_Name As Of Timestamp | Scn Exp SQL> Insert Into testtbl Values(1,'a');1 row insertedSQL> Insert Into testtbl Values(2,'b');1 row insertedSQL> Insert Into

2015-09-04 23:27:35 286

原创 使用Connect By构造序列

使用Connect By Level构造序列Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Connected as system@LOCAL_TESTSQL> set pagesize 1000SQL> SQL> Select * From Test Connect

2015-08-23 23:15:18 419

原创 start with connect by

语法:Select ... From table_table[Where Condition][[Start With Condition ] Connect By Condition][Order Siblings By columnn_name1,...column_nameN  ]Connect By Condition3:连接条件 Prior 指定父记录Start

2015-08-23 21:16:28 226

原创 index

--创建语法:Create [ Unique | Bitmap ] Index [Schema.]index_name On [Schema.]table_name(column_name1 Asc | Desc,...,columne_nameN Asc|Desc )[Tablespace tablespace_name][Reverse]SQL> Create Tabl

2015-08-19 23:14:17 267

原创 role

--创建角色--Create Role role_name [not identified | identified by role_password];SQL> create role role1 not identified ;Role createdSQL> create role role2 identified by a123;Role created--修改用户

2015-08-17 22:04:33 353

原创 sys_privilege & object_privilege

常用系统权限分组1:   1、Create Session   2、Unlimited Tablespace   3、Alter System   4、Alter Database分组2:   1、Create Sequence   2、Create Type    3、Create Table   4、Create View   5、Create Sy

2015-08-17 00:31:32 365

原创 用户管理

----1、创建语法Create User user_nameIdentified By user_passwordDefault Tablespace tablespace_nameTemporary Tablespace temp_tablespace_nameprofilr profile_nameQuota n M On | Unlimited On Tablesp

2015-08-15 00:31:54 424

原创 profile

--1、创建profile格式:Create Profile profile_name Limit参数名1  值1......参数名n  值n;  SQL> Create Profile prof Limit  2  Sessions_Per_User 2  3  Failed_Login_Attempts 2  4  Password_Life_Time

2015-08-12 23:10:06 247

原创 temporary tablespace

--1、查看临时表空间SQL> Select tablespace_name,Contents From dba_tablespaces Where Contents='TEMPORARY';TABLESPACE_NAME                CONTENTS------------------------------ ---------TEMP

2015-08-12 22:03:53 385

原创 pipelined function

(一)语法:   Create Or Replace Function function_name (参数1,...)   Return collection Pipelined   Is     --声明部分  begin     --执行部分     pipe row(...);  --填充元素     return;      

2015-07-27 05:10:55 178

原创 merge into

一、语法:  Merge Into dest_table alais_name Using src_table alias_name On( condition )      When Matched Then Update Set ...[where...] [Delete Where....]     注:delete的作用范围为update过的那些记录      When

2015-07-27 00:12:03 355

原创 触发器

(一)DDL触发器  Create Or Replace Trigger trigger_name   Before | After  [Insert] | [ Or Update [Of 指定列] ] | [ Or Delete]  On table_name   [     For Each Row  --行级触发器 否则为表级触发器      [When(old.

2015-07-22 00:49:32 227

原创 Oracle 集合 plsql记录表

1、语法       Type Record_Table_Type_Name Is Table Of  Record_Type        Index By pls_integer | binary_integer | varchar2 ;       用于处理多行多列数据实例:Declare  Type Record_Table_Type Is Table Of sco

2015-07-11 00:30:37 481

原创 oracle 集合 varray

1、创建语法      Create Or Replace varray_type_name Is Varray(size_limit) Of Element_type [Not Null];      varray_obj varray_type_name;      注:下标从1开始,元素个数有限制 使用变长数组对象元素前,必须使用构造函数初始化2、实例Create O

2015-07-10 02:00:36 1208

原创 oracle 集合 nested_table

1、--创建嵌套表类型      Create Or Replace Type nested_table_type_name Is Table Of element_type;      --创建嵌套表对象      nested_table_variabe_name nested_table_type_name; 注:使用嵌套表对象元素之前必须先初始化。下标从1开始,元素个数

2015-07-10 00:56:03 1795

原创 oracle 集合 index table

1、type index_table_type is table of element_type [not null] index by binary_integer | pls_integer | varchar2      not null 指定集合对象元素值不允许为空      index_table 只允许在plsql中使用,下标可以为负数,元素个数没限制2、 使用例子--

2015-07-10 00:47:44 361

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除