oracle PL/SQL基础知识2

RecordCursorCollectionView

单行多列的一组数据

(具有栏位名的一维数组)

SQL的一个内存工作区

临时存储数据进行使用处理

数组,嵌套表

虚表

不占物理内存

每次使用都会重新执行sql语句

fetch……into

1.多条数组同时处理

2.资料锁定,只能Commit,Rollback才能解除

for update[of column1,column2,column3]

Function有返回值

Procedure能同时进行select,insert,update,delete

多用于显示

(可用于权限,修改基表数据)

1.基于Tabel

①建立View or Table

create or replace view A

as

select xxxxx;

②declare部分

Declare

  record A 参照 %RowType;

③begin…end

Begin

  select xx into xx;

End;

1.隐式游标

oracle系统自动处理,是匿名资料用“sql%属性名”进行操作。

%NotFound

%Found

%isopen

%RowCount 笔数

Index-by Tables



 

2.基于Cursor

(因为view永久存在于oracle中,cursor只是暂时存在,所以使用record必须先声明cursor)

Declare

①声明Cursor

  Cursor cursorA is select xxx;

②声明Record

  recordA cursorA %RowType;

③begin…end

Begin

  xxx;

  fetch cursorA into recordA;//数据放到record

  xxx;

End;

2.显式游标

①声明Cursor

Cursor cursorA is select xx;

②开启Cursor

Open cursorA;

③提取Cursor

Loop

  xxx;

  Fetch cursorA into var1,var2,var3;

  Exit when cursorA %NotFound;

  xxx;

④关闭Cursor

Close cursorA;

Nested Tables 

3.使用者自定义Record

Declare

①定义Record

Type typeA is Record(int file1,varchar2 file2);

②声明Record

recordA typeA;

③Begin...End;

3.具有参数的Cursor

Cursor cursorA(var1int,var2varchar2)

Varrays 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值