Home » RDBMS Server » Server Utilities » Wrapping an oracle package (Oracle 11g)
Wrapping an oracle package [message #571263] Thu, 22 November 2012 11:40 Go to next message
VINORACLE
Messages: 14
Registered: September 2011
Location: Calgary
Junior Member
Hi Friends,
I nned some help on wrapping oracle packages. I hope you will be able to do that as you did it in the past. I have searched the forum and i din't get any posting on this subject.
here is the package
***************
create or replace
PACKAGE "XXXX_COG"
AS

PROCEDURE COG (p_message OUT VARCHAR2, p_detail OUT VARCHAR2, p_value OUT VARCHAR2);


END XXXX_COG;
**************

Here is the body of the package

*************************
create or replace
PACKAGE BODY XXXX_COG
AS

/*PROCEDURE cog--------------------------------------------------------------------------------*/
PROCEDURE cog (p_message OUT VARCHAR2, p_detail OUT VARCHAR2, p_value OUT VARCHAR2) IS
v_ret_val VARCHAR2(4000);
v_mto_default_n NUMBER;
v_mto_default_v VARCHAR2(100);
v_mto_default_x VARCHAR2(100);

BEGIN
v_mto_default_n:=0;
v_mto_default_v:='STEP 2 COMPLETED';
v_mto_default_x:='RUN PIPE_COG PROCEDURE NOW';

DELETE FROM table_cogf;
v_mto_default_n:=v_mto_default_n+1;



INSERT INTO table_cogf SELECT
a.module_no AS "moduleno",
a.discipline_wt AS "module_wt",
a.ength AS "ength",
SYSDATE as "rep_date"
FROM table_cog a
WHERE a.rot_ang is NULL
group by a.module_no, a.discipline_wt, a.length


v_mto_default_n:=v_mto_default_n+1;



IF v_mto_default_n = 1 THEN
v_ret_val := 'QA/QC REPORT IS COMPLETE';
Else
v_ret_val := 'QA/QC REPORT IS COMPLETE';
END IF;


p_message := NVL(v_ret_val, 'QA/QC REPORT IS COMPLETE');
p_detail := NVL(v_mto_default_v, 'QA/QC REPORT IS COMPLETE');
p_value := v_mto_default_x;


END cog;

end XXXX_COG;
**************************

How can I wrap this package so that when I release this package , others dont see the code.

Thanks for you help.

Regards,

Vinod Rajasekharan


Re: Wrapping an oracle package [message #571267 is a reply to message #571263] Thu, 22 November 2012 13:02 Go to previous messageGo to next message
Solomon Yakobson
Messages: 1966
Registered: January 2010
Senior Member
Use DBMS_DDL.CREATE_WRAPPED. For example:

SQL> CREATE OR REPLACE
  2    PACKAGE PKG1
  3      IS
  4        PROCEDURE P1;
  5  END;
  6  /

Package created.

SQL> BEGIN
  2      DBMS_DDL.CREATE_WRAPPED(Q'[
  3  CREATE OR REPLACE
  4    PACKAGE BODY PKG1
  5      IS
  6        PROCEDURE P1
  7          IS
  8          BEGIN
  9              DBMS_OUTPUT.PUT_LINE('This package is wrapped');
 10        END;
 11  END;]');
 12  END;
 13  /

PL/SQL procedure successfully completed.

SQL> SET SERVEROUTPUT ON
SQL> EXEC PKG1.P1;
This package is wrapped

PL/SQL procedure successfully completed.

SQL> SELECT  TEXT
  2    FROM  USER_SOURCE
  3    WHERE NAME = 'PKG1'
  4    ORDER BY TYPE,
  5             LINE
  6  /

TEXT
------------------------------------------------------------------------------------------------------------------------------------
PACKAGE PKG1
    IS
      PROCEDURE P1;
END;
PACKAGE BODY PKG1 wrapped
a000000
b2
abcd
abcd
abcd
abcd

TEXT
------------------------------------------------------------------------------------------------------------------------------------
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd

TEXT
------------------------------------------------------------------------------------------------------------------------------------
b
92 b6
vdl7zrHhcylD1L1gtV8sMuGQtlIwg5m49TOf9b9cuJu/9MPnpZ94XQmm4XJwfGMOLy9du4r8
06td5S9w55Tm8VxpuMAy/tLWTmfdlfp4VxkkIRTKIaIo44YQenNxKneEZWVtlJ7TtwO2616U
qUebUdusrHeOMi72TcnqJB/20S+vpqbF76hQ


SQL>  


SY.
Re: Wrapping an oracle package [message #571293 is a reply to message #571263] Fri, 23 November 2012 01:23 Go to previous message
Michel Cadot
Messages: 58638
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Or simply use "wrap" utility and you then release the wrapped script.

Regards
Michel

[Updated on: Fri, 23 November 2012 01:41]

Report message to a moderator

Previous Topic: problem with opening DBCA and some other utilities
Next Topic: IMPDP hangs
Goto Forum:
  


Current Time: Thu Jul 31 23:01:29 CDT 2014

Total time taken to generate the page: 0.09416 seconds