Oracle提供Wrap工具,可以用於加密你的Package等.
不過需要注意的是,加密後的代碼無法解密,你需要保管好你的源代碼。
以下是個例子:
1.源代碼
create or replace function get_rowid
(l_rowid in varchar2)
return varchar2
is
ls_my_rowid varchar2(200);
rowid_type number;
object_number number;
relative_fno number;
lock_number number;
row_number number;
egin
dbms_rowid.rowid_info(l_rowid,rowid_type,object_number,relative_fno, block_number, row_number);
ls_my_rowid := 'Object# is :'||to_char(object_number)||chr(10)||
'Relative_fno is :'||to_char(relative_fno)||chr(10)||
'Block number is :'||to_char(block_number)||chr(10)||
'Row number is :'||to_char(row_number);
return ls_my_rowid ;
end;
/
2.代碼功能測試
[Oracle@jumper tools]$ sqlplus scott/tiger
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Nov 15 21:56:36 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> @f_get_rowid
Function created.
SQL> select rowid from dept where deptno=10;
ROWID
------------------
AAABiPAABAAAFRSAAA
SQL> select get_rowid('AAABiPAABAAAFRSAAA') from dual;
GET_ROWID('AAABIPAABAAAFRSAAA')
------------------------------------------------------------------
Object# is :6287
Relative_fno is :1
Block number is :21586
Row number is :0
SQL> !
[Oracle@jumper tools]$ ls
ct.sql ddlt.sql f_get_rowid.sql getevent.sql
3.使用wrap加密及加密後的代碼
[Oracle@jumper tools]$ wrap iname=f_get_rowid.sql oname=f_get_rowid.plb
PL/SQL Wrapper: Release 9.2.0.4.0- Production on Mon Nov 15 21:59:39 2004