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语句参数的用法
OracleTransaction myTrans ;
conn.Open();
myTrans =conn.BeginTransaction(IsolationLevel.ReadCommitted) ......
我公司在组建局域网时,考虑到商业企业的特点,仔细考量了购、销、存三大环节中发生的各种数据及其存储问题后,选定了以Windows 2000 Server为操作系统,SQL Server 2000为数据库平台来搭建局域网的应用系统的软件平台,以网线为载体将购、销、存等核心部门的计算机通过局域网平台紧密地连接起来。这样,各个核心部门每天 ......
select Convert( varchar(20) , 时间字段 , 格式 ) from 表 如:select Convert(varchar(20),LOGIN_DATE,112) from dbo.C_PARTY_CLIENT 100:Jun 22 2009 12:00AM 101:06/22/2009 102:2009.06.22 103:22/06/2009 104:22.06.2009 105:22-06-2009 106:22
select Convert(varchar(20),<时间字段>,<格式>) f ......
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 ......
事务是Oracle9i中进行数据库操作的基本单位,在PL/SQL程序中,可以使用3个事务处理控制命令。
1. commit命令
commit是事务提交命令。Oracle9i数据库中,为保证数据一致性,在内存中为每个客户机建立工作区,客户机对数据库进行操作的事务都在工作区完成,只有执行commit命令后,工作区内的修改内容才写入到数据库上,称 ......