惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
Y
Y Combinator Blog
D
DataBreaches.Net
IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
WordPress大学
WordPress大学
H
Help Net Security
GbyAI
GbyAI
C
Check Point Blog
L
LangChain Blog
小众软件
小众软件
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
G
Google Developers Blog
月光博客
月光博客
V
V2EX
M
MIT News - Artificial intelligence
博客园 - 叶小钗

博客园 - liuqun

oracle优化7(如何干预执行计划 - hints) oracle优化6(使用sql_trace/10046事件进行数据库诊断) oracle优化5(用索引提高效率) oracle优化4(sql语句性能诊断,sql执行计划) oracle优化3(访问Table的方式) oracle优化2(选用适合的ORACLE优化器) oracle优化1(数据库、数据表、数据表I/O优化原则) Oracle常用命令14(.net / java代码调用(sql代码、程序包过程)) Oracle常用命令13(数据库的启动、关闭) Oracle常用命令12(导入:imp、导出:exp) Oracle常用命令11(触发器) Oracle常用命令10(程序包) Oracle常用命令9(函数) Oracle常用命令7(游标) Oracle常用命令6(PL/SQL) Oracle常用命令5(同义词、视图、索引) Oracle常用命令4(表分区) Oracle常用命令3(DDL、DML、TCL、DCL、序列) Oracle常用命令2(用户、角色管理)
Oracle常用命令8(过程)
liuqun · 2011-03-29 · via 博客园 - liuqun

过程 

CREATE [OR REPLACE] PROCEDURE

   <procedure name> [(<parameter list>)]

IS|AS

   <local variable declaration>

BEGIN

   <executable statements>

[EXCEPTION

   <exception handlers>]

END;

调用过程

1Execute 过程名(参数列表);

2

begin

       过程名(参数列表);

End;

1:用户注册(用户名不能重复)

Create or replace procedure proc_UserAdd(p_name varchar2,p_realyname varchar2, p_password varchar2,p_tel varchar2, p_email varchar2,p_address varchar2, isSuccess out number)

       is    

              count_add number(4);

       begin

              //判断用户是否存在

              select count(*) into count_add from userTab where u_name=p_name;

              if count_add<1 then

                     insert into userTab values(seq_user.nextval,p_name,p_realyname,p_password,p_tel, p_email,p_address);

                     isSuccess := 1;

                     dbms_output.put_line('注册成功');

              else

                     isSuccess := 0;

                     dbms_output.put_line('用户名已存在,请重新注册!');

              end if;

       exception

              when others then

                     dbms_output.put_line('错误!');

       end;

测试用户注册:

declare

       isSuccess number(4);

begin

       proc_UserAdd('zhongzi2','周姿','zhongzi','2526294','zhong@163.com','湖南省湘潭', isSuccess) ;

       dbms_output.put_line( isSuccess );

end;