get_deptno.sql:
create or replace function get_deptno
(p_deptno in varchar2)
return varchar2
is
p_deptname varchar2(10);
begin
select dname into p_deptname from dept where deptno = p_deptno;
return p_deptname ;
end;
/
select get_deptno(20) from dual
wrap iname=get_deptno.sql oname=get_deptno.plb
drop function get_deptno;
@get_deptno.plb;
select get_deptno(20) from dual;
/////////////////////////////////////////////////////////////////
ora10glin->ls
Desktop get_deptno.sql
ora10glin->sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 27 11:54:28 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn scott/tiger
Connected.
SQL> @get_deptno.sql;
Function created.
ora10glin->wrap iname=get_deptno.sql oname=get_deptno.plb
PL/SQL Wrapper: Release 10.2.0.1.0- Production on Fri Nov 27 11:55:22 2009
Copyright (c) 1993, 2004, Oracle. All rights reserved.
Processing get_deptno.sql to get_deptno.plb
ora10glin->ls
Desktop get_deptno.plb get_deptno.sql
ora10glin->cat get_deptno.plb
create or replace function get_deptno wrapped
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
8
c7 c2
OT3ACF+2ruL4CpD94I6vluqVGPkwgy7cf8vWZ3QebuowRjsBADJTGURXvdOO5toztZ1NTcs3
SdotYv4TFJbFBLSdWB8fY8kmdOmlSqfUEUwM1LwxQg7CCSrUWC2GMCrQEv24rId6jqjYelLA
XaoO49XRRO0pX0zugsJ//EbB7rNnTbbRJmdWrWg/T69/dw==
/
SQL> drop function get_deptno;
Function dropped.
SQL> @get_deptno.plb;
Function created.
SQL> select get_deptno(20) from dual
2 ;
GET_DEPTNO(20)
--------------------------------------------------------------------------------
RESEARCH
/////////////////////////////////////////////////////////////////
如果出现如下错误:
kgepop: no error frame. to pop to for error 1801
则需要设置正确的环境变量:NLS_LANG
例如在WIndows下可以如下设置:
C:/oracle/ora92/bin>set NLS_LANG=CHINESE_CHINA.ZHS16GBK(根据具体环境确定)