PL/SQL 11g R2 —— PL/SQL程序 !
来源:互联网 发布:定位追踪软件 编辑:程序博客网 时间:2024/03/28 18:33
例子1:返回一行、多列记录。
SQL> set serveroutput onSQL> declare 2 v_emp_hiredate employees.hire_date%type; 3 v_emp_salary employees.salary%type; 4 begin 5 select hire_date,salary into v_emp_hiredate,v_emp_salary 6 from employees where employee_id = 100; 7 dbms_output.put_line('Hire date is :' || v_emp_hiredate); 8 dbms_output.put_line('Salary is :' || v_emp_salary); 9 end; 10 /Hire date is :17-6月 -03Salary is :24000PL/SQL 过程已成功完成。
例子2:返回一行、多列记录。
SQL> set serveroutput onSQL> declare 2 type employees_record_type is record(v_first_name employees.first_name%type,v_salary employees.salary%type); 3 employees_record employees_record_type; 4 begin 5 select first_name,salary into employees_record from employees where employee_id = 100; 6 dbms_output.put_line(employees_record.v_first_name || employees_record.v_salary); 7 end; 8 /Steven24000PL/SQL 过程已成功完成。
游标的四个属性:
游标名%isopen --如果当前游标打开则返回true,否则返回false.
游标名%found --如果当前游标读取到数据则返回true,否则返回false.
游标名%notfound --如果当前游标未读取到数据则返回true,否则返回false.
游标名%rowcount --返回截止到目前为止当前游标读取到的数据的行数.
例子3:返回多行、多列记录。
SQL> set serveroutput onSQL> declare 2 cursor v_cursor is select first_name,salary from employees; 3 v_first_name employees.first_name%type; 4 v_salary employees.salary%type; 5 begin 6 open v_cursor; 7 loop fetch v_cursor into v_first_name,v_salary; 8 exit when v_cursor%notfound; 9 dbms_output.put_line(v_first_name || v_salary); 10 end loop; 11 close v_cursor; 12 end; 13 /Donald2600Douglas2600Jennifer4400... ...PL/SQL 过程已成功完成。
- PL/SQL 11g R2 —— PL/SQL程序 !
- PL/SQL 11g R2 —— PL/SQL概述 !
- PL/SQL 11g R2 ——动态SQL
- PL/SQL 11g R2 —— 复合数据类型应用
- PL/SQL 11g R2 —— 事务
- PL/SQL 11g R2 —— 游标
- PL/SQL 11g R2 —— 异常处理
- PL/SQL 11g R2 —— 存储过程
- PL/SQL 11g R2 —— 函数
- PL/SQL 11g R2 —— 包
- PL/SQL 11g R2 —— 触发器
- PL/SQL 11g R2 —— 定义PL/SQL变量 !
- PL/SQL 11g R2 —— PL/SQL结构控制语句 !
- PL/SQL Developer 连接Oracle Database 11g R2配置
- 【DB.PL/SQL】程序数据类型 ——
- Oracle 11g PL/SQL程序块,存储图片等BLOB字段类型的列PL/
- PL/SQL Developer 连接Oracle Database 11g R2配置笔记
- Oracle 11g R2 64bit+PL/SQL+32bit客户端
- 一天学会PHP编程(菜鸟必看,不看后悔)
- 关于NoClassDefFoundError
- Ext江湖
- asp快速分页代码
- VisualStudio2008 工具箱里的项重复出现的问题
- PL/SQL 11g R2 —— PL/SQL程序 !
- 使用X-UA-Compatible来设置IE兼容模式
- 例详解$_SERVER函数中QUERY_STRING和REQUEST_URI
- PHP:避免重复提交和检查数据来路
- Java计算器源码
- 为什么微软的开发人员需要一个风格指南
- Android通信之 Bluetooth
- VMWare的三种网络工作模式
- ubuntu下nginx+Mysql+php的安装和配置