Oracle 存储过程
create or replace procedure p //有就替换,没有就创建
is
cursor c is
select * from emp for update;
begin
for v_emp in c loop
if (v_emp.deptno =10) then
update emp2 set sal*2 where current of c;
elsif () then
update emp2 set sal*2 where current of c;
else
update emp2 set sal*2 where current of c;;
end if;
end loop;
commit;
end;
2、执行
exec p;
--------
begin
p;
end;
3、带参数的存储过程
create or replace procedure p
(v_a in number,v_b number,v_ret out number,v_temp in out number) //in 传的参数,out传出参数
is
begin
if(v_a>v_b) then
v_ret:=v_a;
else
v_ret :=v_b;
end if;
v_temp:=v_temp+1;
end;
使用:
declare:
v_a number :=3;
v_b number :=4;
v_ret number;
v_temp number :=5;
begin
p(v_a,v_b,v_ret,v_temp);
dbms......(v_ret);
dbmmm.....(v_temp);
end;
如果有错误 ,可以执行show error 命令显示错误信息
4、function函数
create or replace function sal_tax
(v_sal number)
return number;
is
begin
if (v_sal<2000) then
return 0.10;
elsif (v_sal<2750) then
return 0.15;
 
相关文档:
1. 检查Oracle的进程
$ ps -ef|grep "ora_"|grep -v grep
oracle 5998 1 0 11:15:59 ? 0:01 ora_j000_PPRD10
oracle 2968 1  ......
选择自 softj 的 Blog
关键字
PL/SQL实现Oracle数据库任务调度
出处
PL/SQL实现Oracle数据库任务调度
关键词:数据恢复,任务调度,ORACLE,PL/SQL
在数据库操作中时常会有这样的情况发生,由于一时的疏忽而误删或误改了一些重要的数据,另外还有 ......
一、选择题
1.当你执行以下查询语句:
SELECT empno,ename
from emp
WHERE empno =7782 OR empno =7876;
在WHERE语句中,以下哪个操作符可以取代OR?
A. IN
B. BETWEEN ……
C. LIKE
D. <=
E. >=
2. 哪个实现  ......
1、查找表的所有索引(包括索引名,类型,构成列):
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查询的表
2、查找表的主键(包括名称,构成列):
select cu.* from user_cons_columns cu, user_con ......
一、 常用日期数据格式
1.Y或YY或YYY 年的最后一位,两位或三位
SQL> Select to_char(sysdate,'Y') from dual;
TO_CHAR(SYSDATE,'Y')
--------------------
7
SQL> Select to_char(sysdate,'YY') from dual;
TO_CHAR(SYSDATE,'YY')
---------------------
07
SQL> Select to_char(sysdate,'YYY') from ......