Oracle SQL脚本学习记录一
2014-06-04 00:00
190 查看
摘要: Oracle SQL脚本学习记录一
set serveroutput on declare v_age number; begin v_age:=12; v_age:=v_age/0; exception when ZERO_DIVIDE then dbms_output.put_line(‘divde by zero’); end; declare v_name varchar2(10); begin v_name:=’wmsjhappy’; DBMS_OUTPUT.PUT_LINE(v_name); end; / declare begin select * from tb_personresumes; end; / ——————————————————————————————————————- create table protest (name varchar2(10),pass varchar2(10)); insert into protest values (‘wmsjhappy’,’20070701′); select * from protest; commit; CREATE or replace procedure sp_proUserInfo(sApName varchar2,sApPass varchar2) is begin update protest set name=sapname,pass=sappass; end; commit; call sp_proUserInfo(‘diwaycom’,'radius’); exec sp_proUserInfo(‘diway’,'radius’); select * from protest; commit; select * from protest; DECLARE CURSOR c1 IS SELECT prod_id, cust_id, time_id, amount_sold FROM sales WHERE amount_sold > 100; c1_rec c1%rowtype; l_cust_first_name customers.cust_first_name%TYPE; l_cust_lasT_name customers.cust_last_name%TYPE; BEGIN FOR c1_rec IN c1 LOOP – Query customer details SELECT cust_first_name, cust_last_name INTO l_cust_first_name, l_cust_last_name FROM customers WHERE cust_id=c1_rec.cust_id; – – Insert in to target table – INSERT INTO top_sales_customers ( prod_id, cust_id, time_id, cust_first_name, cust_last_name,amount_sold ) VALUES ( c1_rec.prod_id, c1_rec.cust_id, c1_rec.time_id, l_cust_first_name, l_cust_last_name, c1_rec.amount_sold ); END LOOP; COMMIT; END; create table protest(name varchar2(10),pass varchar2(10)); set serveroutput on; declare cursor get_date is select name,pass from protest; begin for i in get_date loop DBMS_OUTPUT.PUT_LINE(‘name: ‘||i.name||’ pass: ‘||i.pass); end loop; end; / L> declare cursor t is select susername from tbl_usersagentgoogle; tname t%rowtype; begin for tname in t loop select susername into tname from tbl_usersagentgoogle; end loop; end; /
相关文章推荐
- Oracle SQL脚本学习记录三
- Oracle SQL脚本学习记录二
- Oracle SQL脚本学习记录四
- oracle使用sql脚本生成csv文件案例学习
- oracle sql 学习记录
- JAVA_WEB Oracle 10g学习: PL/SQL集合与记录
- 一、Oracle学习总结和SQL记录
- oracle开发之<<SQL Cookbook>>学习笔记整理:第一章 检索记录
- 【ORACLE】记录通过执行Oracle的执行计划查询SQL脚本中的效率问题
- 常用的SQL*PLUS命令 ,SQL缓冲区操作和最基本的脚本操作(从实践中学习Oracle SQL-第三章)
- ORACLE PL/SQL 记录(Record)学习笔记(二)
- 数据库学习之一: 在 Oracle sql developer上运行SQL必知必会脚本
- Oracle SQL脚本学习记录五
- Oracle SQL脚本学习6
- Oracle学习记录二——SQL基础
- [学习记录] oracle 给用户授权相关sql
- 两天的oracle学习经验,以及对数据库脚本的认识。sql语句的一些细节还是费了不少劲的。
- Oracle使用超大SQL脚本文件恢复数据问题记录
- ORACLE PL/SQL 记录(Record)学习笔记(一)