ORACLE过程、函数
过程、函数
create or replace procedure p1
is
empname emp.ename%type;
begin
select ename into empname from emp where empno=7788;
dbms_output.put_line(empname);
end;
SQL> ed
SQL> /
Procedure created
SQL> exec p1;
SCOTT
PL/SQL procedure successfully completed
create or replace procedure p1(eno emp.empno%type)
is
empname emp.ename%type;
begin
select ename into empname from emp where empno=eno;
dbms_output.put_line(empname);
end;
SQL> ed
SQL> /
Procedure created
SQL> exec p1(7788);
SCOTT
PL/SQL procedure successfully completed
create or replace procedure p1(eno in emp.empno%type)
is
empname emp.ename%type;
begin
select ename into empname from emp where empno=eno;
dbms_output.put_line(empname);
end;
SQL> ed
SQL> /
Procedure created
SQL> exec p1(7788);
SCOTT
PL/SQL procedure successfully completed
create or replace procedure p1(eno in emp.empno%type,outname out emp.ename%type)
is
empname emp.ename%type;
begin
select ename into empname from emp where empno=eno;
outname:=empname;
end;
declare
empname emp.ename%type;
begin
p1(7788,empname);
dbms_output.put_line(empname);
end;
SQL> ed
SQL> /
SCOTT
PL/SQL procedure successfully completed
create or replace procedure p1(eno_name in out emp.ename%type)
is
empname emp.ename%type;
begin
select ename into empname from emp where empno=eno_name;
eno_name:=empname;
end;
declare
empname emp.ename%type;
begin
empname:=7788;
p1(empname);
dbms_output.put_line(empname);
end;
SQL> ed
SQL> /
SCOTT
PL/SQL proc
相关文档:
1.准备工作:
安装32位或64位RHEL5.4,安装向导中不需要选任何组件,不需要预配置任何用户,IP是DHCP或静态皆可。
安装后配置额外组件:
yum -y install libXp,make,binutils,gcc,kernel-headers,glibc-headers,glibc-devel,libgomp
在x86_64上还需要compat-libstdc++-33.x86_64
对x86,上传并解压10201_database_lin ......
网上有很多的资料,参考itput(http://space.itpub.net/471666/viewspace-215923)的。
OS : Redhat
DB : Oracle 10.2.0.4.0
1.修改jdk 下面的字体。
[oracle@a ~]$ cd $ORACLE_HOME/jdk/jre/lib/
[oracle@a ~]]$ mv font.properties font.properties_bak
[oracle@a ~]]$
[oracle@a ~]]$ cp font.properties.zh_CN.R ......
http://tech.163.com/05/0701/10/1NIODMQS00091589.html
因为在PL/SQL 中并没有数组.
这是偶查资料找的范例和自己写的范例来解释如何在PL/SQL 中使用数组. 也许很多人已知道, 不过就是让不知道的朋友们了解一下吧。
----------------------
单维数组
------------------------
DECLARE
TYPE
emp_ssn_array IS TA ......
select custid,carid,Cunote,INVNO,BUYPLAN
from ( select custid,carid,Cunote,INVNO,BUYPLAN,
row_number() over(partition by custid,carid order by Feedbackid desc) rn
from pvE3S.T_VCTM_CUSTOMER_FEEDBACK) t1 where rn=1
按Feedbackid 排序,rn是前N行 ......
程序包
包主体/规范名字一样
包主体/规范中的对应参数必须类型及名字一样
只能使用强类型的REF游标
创建程序包规范
create or replace package my_pack
is
procedure find_emp_proc(eno emp.empno%type);
function fin ......