oracle 存储过程和函数学习笔记
oracle 存储过程和函数学习笔记
1、创建过程的语法:
Code
create [or replace] procedure procedure_name
[(argument[{in|out|in out}] type,
argument[{in|out|in out}] type)] {is|as}
procedure_body
简单的例子:
Code
create procedure RaiseError(
/*if p_Raise is true,then an unhandled error is raised.
if p_Raise is false,the procedure completes successfully.*/
p_Raise in boolean:=true,
p_ParameterA out number) as
begin
p_Parameter1:='abcdwxc';
p_Parameter2:=143;
end ParameterLength;
删除过程语法:
drop procedure procedure_name;
2、创建函数的语法:
Code
create [or replace] function function_name
[(argument[{in|out|in out}] type,
argument[{in|out|in out}] type)]
return return_type {is|as}
function_body
简单函数的例子:
create function ClassInfo(
p_Department classes.department%type,
p_Course classes.course%type)
return varchar is
v_CurrentStudents number;
v_MaxStudents number;
v_PercentFull numbe
相关文档:
PB自带的REPLACE语句用着总有些不习惯。今天同事在做数据迁移中,用到替换功能,根据不同的登录用户,选择该用户下的表。所以,我就用ORACLE的函数来实现它。其实挺简单的,就是一个PB动态SQL语句的例子而已。下面是个例子,SQL语句自已拼装好。注意拼装的SQL语句末尾不要习惯的加“; ......
以下是在后台更新易拓ERP数据库时遇到的一个问题:
1.在DB14数据库中将料件号P44开头,并且品名为"塑料袋"的料件改为消耗性料件.
这个简单: UPDATE DB14.ima_file SET ima70 = ‘Y’ WHERE ima01 like ‘P44%’ AND ima0 ......
选择自 softj 的 Blog
关键字
PL/SQL实现Oracle数据库任务调度
出处
PL/SQL实现Oracle数据库任务调度
关键词:数据恢复,任务调度,ORACLE,PL/SQL
在数据库操作中时常会有这样的情况发生,由于一时的疏忽而误删或误改了一些重要的数据,另外还有 ......
在SQL语句优化过程中,我们经常会用到hint,现总结一下在SQL优化过程中常见Oracle HINT的用法:
1. /*+ALL_ROWS*/
表明对语句块选择基于开销的优化方法,并获得最佳吞吐量,使资源消耗最小化.
例如:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
表 ......
方法一:
----------------------------------------------------------------
---Muti-row to line(col2row)
----------------------------------------------------------------
create or replace type str_tab is table of varchar2(20);
/
grant all on str_tab to public;
create public synonym str_tab for ......