oracle 块结构
来源:互联网 发布:官方经纬度定位软件 编辑:程序博客网 时间:2024/06/08 11:07
1.块基本语法
首先输出命令: set serveroutput on;为了可以让输出从窗口中输出来
基本语法:
declare v_width integer; v_height integer := 2; v_area integer := 6;begin --set the width equal to the area divided by the height; v_width := v_area / v_height; DBMS_OUTPUT.put_line('V_width = ' || v_width );exception when ZERO_DIVIDE THEN DBMS_OUTPUT.put_line('division by zero');end;
条件逻辑:
declare tmp integer := 52; begin if tmp > 10 then DBMS_OUTPUT.put_line(' TMP 是大于 10 的数'); else DBMS_OUTPUT.put_line('TMP 并不大于 10'); end if; end;
简单循环
declare tmp integer;begin tmp := 0; loop tmp := tmp + 1; DBMS_OUTPUT.put_line('TMP ==' || tmp); exit when tmp = 5; end loop;end;
while循环
declare tmp integer := 0;begin while tmp < 6 loop tmp := tmp + 1; DBMS_OUTPUT.put_line('TMP =='|| tmp); END LOOP;END;
for循环
declare tmp integer := 0;begin for tmp in 1..5 loop DBMS_OUTPUT.put_line('tmp ='||tmp); end loop;END;
使用游标来获取查询数据
declare v_name test1.name %type; v_age test1.age %type; cursor test1_cursor IS select NAME,age from test1 t;begin open test1_cursor; loop -- fetch the rows from the cursor fetch test1_cursor into v_name,v_age; --exit the loop when there are no more rows,as indicated by the boolean variable test1_cursor%notfound( = true when there are no more rows) exit when test1_cursor%notfound; DBMS_OUTPUT.put_line('NAME = ' || v_name || ' age = ' || v_age); end loop; close test1_cursor;end;
游标与for循环 :可以显示的开 关游标
declare v_name test1.name %type; v_age test1.age %type; cursor test1_cursor IS select NAME,age from test1 t;begin for t in test1_cursor loop DBMS_OUTPUT.put_line('NAME =' || T.NAME || 'AGE = '|| T.AGE); end loop;end;
阅读全文
0 0
- oracle 数据块结构
- oracle 数据块结构
- oracle 块结构
- Oracle数据块结构剖析
- oracle结构 段>区段>数据块
- oracle btree index 索引块结构初探
- Oracle学习——块结构
- Oracle逻辑存储结构---(一) 数据块
- Oracle存储结构(段、区、块)认识
- Oracle的逻辑结构(表空间、段、区间、块)——Oracle数据块(一)
- Oracle的逻辑结构(表空间、段、区间、块)——Oracle数据块(二)
- Oracle的逻辑结构(表空间、段、区间、块)——Oracle数据块
- oracle存储结构: 表空间/数据文件/段/分区/块
- 24、oracle存储结构: 表空间/数据文件/段/分区/块
- Oracle PLSQL 学习笔记(块、控制结构、过程、函数、包)
- 使用BBED帮助理解Oracle数据块结构
- 使用BBED帮助理解Oracle数据块结构
- Oracle ASSM三级位图块结构(未看)
- Android串口通信
- hpuoj 【1350】按规律输出数组【水题】
- channelRead & channelReadComplete
- LeetCode 404 Sum of Left Leaves
- select2二级联动存在默认值的情况下第二级默认值有时会加载不上
- oracle 块结构
- HTML5拖放事件与购物车案例
- 流量控制、可靠传输与滑动窗口机制
- 正则表达式基本语法
- bash shell configuration
- STL 迭代器删除,插入元素发生的事情
- maven 仓库汇总
- Mybatis的集合查询
- 计算系统启动过程(详细)