Oracle 笔记之 存储过程的使用
| [日期:2011-09-17] |
来源:Linux社区
作者:myxx520 |
[字体:大 中 小]
|
- /*
- 创建存储过程
-
- create or replace procedure proc_name as
- begin
- do something;
- end proc_name;
- */
-
- create or replace procedure updateA as
- begin
- update A set ename='DOG';
- commit;
- end updateA;
-
-
-
- begin
- updateA;
- end;
- select * from A;
-
-
- /*创建带有输入参数的存储过程*/
-
- create or replace procedure myproc(p_name varchar2
- ,p_job varchar2
- ,p_mgr number
- ,p_hiredate date
- ,p_sal number
- ,p_com number
- ,p_deptno number
- ,out_count out number)
- as
- begin
- declare v_count integer;
- begin
- select count(*) into v_count from emp;
- dbms_output.put_line(v_count);
- insert into emp values(v_count+1,p_name,p_job,p_mgr,p_hiredate,p_sal,p_com,p_deptno);
- select count(*) into out_count from emp;
- end;
- end myproc;
-
- declare v_out_count number;
- begin
- myproc('AAc','CLERK',1,to_date('2011-09-12','yyyy-MM-dd'),1,1,20,v_out_count);
- end;

评论声明
- 尊重网上道德,遵守中华人民共和国的各项有关法律法规
- 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
- 本站管理人员有权保留或删除其管辖留言中的任意内容
- 本站有权在网站内转载或引用您的评论
- 参与本评论即表明您已经阅读并接受上述条款
|
|
|
|