Oracle 操作函数
函数:
1.使用Create Function 语句创建
2.语
法:
Create or replace Function 函数名[参数列表]
Return 数据类型
IS|AS
局部变量
Begin
可执行语句
end;
3.访问函数
-用两种方式进行访问
使用PL/SQL块
使用SQL语句
-仅接受In参数
示例:
create or replace function
GetName(sNo varchar2)
return varchar Is --不能指定精度
name
varchar(12);
Begin
select ename into name from emp
where empno=sNo;
return name;
Exception
when
Too_many_rows then
DBMS_output.put_line('返回值多余一条');
when
Others then
DBMS_output.put_line('在执行函数GetName时出现意外错误!');
End;
/
调用
declare
name varchar(12);
begin
name:=getname('7369');
DBMS_output.put_line('结果为:'||name);
end;
/
数据字典:user_source
编译时出错的数据字
典:user_errors;
或 show errors;
select * from user_source from where
name='GETNAME'; --注意大写
过程与函数
过
程 函数
作为
PL/SQL语句执行 &nb
相关文档:
搞oracle都会经常碰到rowid,本文是笔者根据网上各位的文章,加上自己学习中的体会,总结而成。
一.rowid简介
rowid就是唯一标志记录物理位置的一个id,在oracle 8版本以前,rowid由file#+block#+row#组成,占用6个bytes的空间,10 bit 的 file# ......
-- get all dictionary for oracle db
select * from dict;
--select * from dictionary;
-- get all columns for dictionarys
select * from dict_columns;
-- get the default name-space for current user
select username,default_tablespace from user_users;
-- get roles for current user
select * from us ......
大家都知道,用PL/SQL连接Oracle,是需要安装Oracle客户端软件的。有没要想过不安装Oracle客户端直接连接Oracle呢?
其实我一直想这样做,因为这个客户端实在太让人讨厌了!!!不但会安装一个JDK,而且还会把自己放在环境变量的最前面,会造成不小的麻烦。
&n ......
方法一:
1) 查看服务器端字符集: &nbs ......
从概念到示例—Oracle创建程序包
一、程序包的相关知识
1.定义与说明
a. 相关对象的封装
b. 程序包的各部分
- 程序包规格说明
声明子程序
- 程序包主体
......