易截截图软件、单文件、免安装、纯绿色、仅160KB

PL/SQL学习笔记六


1.创建过程
create or replace procedure 过程名 as
   声明语句段;
begin
   执行语句段;
exception
   异常处理语句段;
end;
2. 带参数的过程
参数类型3种
in参数:读入参数,主程序向过程传递参数值
out参数:输出参数,过程向主程序传递参数值
in out参数:双向参数
定义带参数的过程示例:
Set  serveroutput on
create or replace procedure scott.tempprocedure(
   tempdeptno in scott.dept.deptno%type, --输入参数
   tempdname out scott.dept.dname%type, --输出参数
   temploc in out scott.dept.loc%type) as -- 双向参数
   loc1   scott.dept.loc%type;
   dname1 scott.dept.dname%type;
begin
   select loc  into loc1
   from  scott.dept
   where  deptno=tempdeptno;
   select dname  into dname1
   from  scott.dept
   where  deptno=tempdeptno;
   temploc:='地址:'||loc1;
   tempdname:='姓名'||dname1;
end;
使用带参数的过程示例:
set serveroutput on
declare 
   myno  scott.dept.deptno%type;
   mydname  scott.dept.dname%type;
   myloc  scott.dept.loc%type;
begin
   myno:=10;
   mydname:='';
   myloc:='';
   scott.tempprocedure(myno,mydname,myloc);
   dbms_output.put_line(myno);
   dbms_output.put_line(mydname);
   dbms_output.put_line(myloc);
end;


相关文档:

C#中操作Oracle时的SQL语句参数的用法

C#中操作Oracle时的SQL语句参数的用法
OracleTransaction myTrans ;
            conn.Open();
            myTrans =conn.BeginTransaction(IsolationLevel.ReadCommitted) ......

Sql Server中如何判断表或者数据库的存在

sql server中如何判断表或者数据库的存在,但在实际使用中,需判断Status状态位:
其中某些状态位可由用户使用 sp_dboption(read only、dbo use only、single user 等)进行设置:
1 = autoclose;使用 sp_dboption 设置。 数据库完全关闭,其资源在最后一个用户注销后释放。
4 = select into/bulkcopy;使用 sp_dbopti ......

Sql server 时间段查询 的相关费解问题

sql server 时间段查询。
==========================================
select g.borrowTime  from t_apartment_goodsborrow g
where g.borrowTime >= '2010-03-11 9:50:43'
2010-03-11 9:52:54
----------------------------------------------------------------------------
select g.borrowTime  ......

经典SQL语句大全

下列语句部分是Mssql语句,不可以在access中使用。
  SQL分类:
  DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE)
  DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT)
  DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)
  首先,简要介绍基础语句:
  1、说明:创建数据库
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号