oracle :存储过程和函数的几种写法
关于存储过程和函数的定义网上一搜一大把,这里就不特殊介绍了,这里就只对我自己写的几种格式的存储过程和函数做一些总结,希望对大家有点帮助。
一:存储过程
1:最普通的一种。(传参,查询游标,执行,循环游标做插入动作)。
create or replace procedure zy2040_sirole(rolekey in varchar2) is
roleid varchar2(30);
cursor cur_zy2040_department_id(rolekeys in varchar2) is
select distinct d.department_id
from si a, si_staff b, sec_staff c, sec_department d
where a.siid = b.siid
and b.staffid = c.staff_id
and c.department_id = d.department_id
and a.provinceid = '0'
and a.si_status in ('A', 'W')
and d.department_id not in
(select a.department_id
from sec_department_role a, sec_role b
where a.role_id = b.role_id
and b.role_key = rolekeys);
cursor cur_zy2040_staffid(rolekeys in varchar2) is
select distinct b.staffid, d.department_id
from si a, si_staff b, sec_staff c, sec_department d
where a.siid = b.siid
and b.staffid = c.staff_id
and c.department_id = d.department_id
and a.provinceid = '0'
and a.si_status in ('A', 'W')
and b.staffid not in (select a.staff_id
&nb
相关文档:
1.create alter insert update select等
如何建表
学生表student
create table student( --学生表
xh number(4), --学号
  ......
用途: <1>模块化
<例子> --公司的员工的管理
1.增加一个员工
2.员工离职
用存储过程和函数来实现
1.增加一个员工
create sequence seq1 start with 7935;
create or replace function insert ......
a)数据库本身的优化
初始化文件 init.ora
open_cursors = 150 打开的游标的个数
很多的存储过程的时候 可以把它调大些
......
数据字典dict总是属于Oracle用户sys的。
1、用户:
select username from dba_users;
改口令
alter user spgroup identified by spgtest;
2、表空间:
select * from dba_data_files;&nbs ......