wrap the procedure in the package

Hi all

Is it possible to encapsulate some of the procedures or functions in the package in Oracle 11 g? For example if I have 4 procedures overall, I want only 2 of them to be wrapped up.

Thanks in advance,

Alexander.

No, but you can always create a separate package containing the procedures you want to encapsulate only.

Tags: Database

Similar Questions

  • Debug/run procedures within the package

    Debugging with SQL Developer was generally very nice and I have come to rely on these tools. Today, I've written a procedure in a package and I want to debug this process, but I don't see it in the list of targets. It seems that I see only functions in the target list. I understand that the procedures need not have the same kind of output in function, but sometimes I like to create procedures that have multiple SETTINGS, especially when it comes to an exit very closely related.

    The interesting thing is that I can create this same procedure as a stand-alone procedure and the run/debug works great. Apparently I'm missing something obvious in SQL Developer somewhere I thought it was there all the time (I guess for a while since I've written a procedure with OUT parameters) but maybe I'm wrong. Any ideas or help someone?

    Earl

    It should work.

    Is that you can create a package of simple heel with just a function procedure that is a NULL; and use it as a test?

    If this does not work there either, please send a screenshot so we can see what you see in the debugging with the missing procedure dialog box.

  • call a procedure of package DB type complicated if the type defined in the package itself

    Hello world

    I use jdev 11.1.1.7.0

    I defined a package of data with a procedure and internal two types as follows:

    Create Or Replace Package Db_Package As 
    
    Type rec Is Record(Rec_Type Varchar2(10), Rec_Desc varchar2(10) );                        
    Type recordList Is Table Of rec;
    
    Procedure Test_Procedure(p_out out recordList);
    END db_package;
    
    
    

    evil

    I want to call this procedure in the module of the application. I know how to call a procedure or function db AM,

    but in this case that I've defined two types in the package itself and I use one of these types as to the procedure output parameter, I had a problem.

    below is the example of code to call the db procedure, but it does not work because the plsqlBlock.registerOutParameter () setting will not

            CallableStatement plsqlBlock = null;
            String statement = "Begin DB_PACKAGE.Test_Procedure(:1); END;";
            try {
                plsqlBlock = getDBTransaction().createCallableStatement(statement, 0);
                plsqlBlock.registerOutParameter(1, OracleTypes.ARRAY);// it doesn't work
                plsqlBlock.executeUpdate();
                Object object = plsqlBlock.getObject(1);      
    
    
            } catch (Exception e) {
                e.printStackTrace();
            }
    
    
    
    

    I know that if I set the types of packets (rec, recordList) as types of oracle (instead of setting in the packaging itself) so I can call the procedure with success, in this case I should use below:

    plsqlBlock.registerOutParameter(1, OracleTypes.ARRAY,"Recordlist");
    

    but I wonder how you can call a procedure from the package if the types defined in the package itself.

    Kind regards

    Habib

    JDBC supports the types of oracle level package only from 12 c database and jdbc driver ojdbc7 (which requires java 7).

    Dario

  • I want to find the string "EMP1" procedures have this chain of the package

    Hi team,

    I have a package, the package, it has 70 technical acts, I want to find the string "EMP1" what procedures to have this channel under this package.
    If I use dba_source its name from package edition only. not to say about wise procedures in this package.
    can you please help here to find procedure under the package names because I analysis for all of the schema.

    Thanks in advance.

    Thanks and greetings
    Vincent

    Hello

    You can use the pl/sql program to do this by giving the name of the package as an input. It won't like your exact expectations. But of course, it will help you.



    DECLARE

    CURSOR c1 IS

    SELECT *.

    From all_source b

    WHERE upper (b.text) like '% EMP1% '.

    AND b.name = & nom_package

    ONLINE ORDERING;

    CURSOR c2 (ln_line NUMBER) IS

    SELECT *.

    From all_source one

    WHERE b.SID = & nom_package

    AND (UPPER (a.TEXT) LIKE '% FUNCTION %') OR UPPER (a.TEXT) LIKE '% PROCEDURE % '.

    AND a.line<=>

    ORDER BY desc line;

    lv_source all_source % rowtype;

    BEGIN

    I'm in c1 LOOP

    --

    OPEN c2 (i.line);

    Get INTO lv_source c2;

    dbms_output.put_line (' procedure ' | lv_source.) Line: ' text: ' | lv_source. (Text);

    CLOSE C2;

    --

    END LOOP;

    END;

    /




    Concerning

    Patrick Reddy.K

  • Copy the package/procedure of a diagram to another diagram

    Dear all,

    I have two of the schema in a single database. I need to copy all A scheme procedures in scfhema B.Is there an easy way to copy only the packages and procedures? If there is no code existing please let me know.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    "CORE 11.2.0.1.0 Production."

    AMT for Linux: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    Regsards,

    S.Balraj

    Dear all,

    Here's the good explantion

    http://www.ulaska.com/Oracle/copy_object_between_schemas.html

  • Procedure is not recognized in the package body

    I have this error message:

    Compile for HR.MILOS_PACKAGE BODY of PACKAGE errors

    Error: PLS-00323: subprogram or cursor "RAISE_SALARY" is declared in a package specification and must be defined in the package body

    Online: 19

    Text: IF (l_exists)

    I deffined in the whole of the body after the first procedure that is no problem.

    I don't know what the problem is. There is no other sugestions compiler.

    Procedure works very well when packing.

    PROCEDURE RAISE_SALARY (p_perc p_dep_id NUMBER, NUMBER) IS

    v_emp_id employees.employee_id%TYPE;

    v_sal employees.salary%TYPE;

    v_avg_sal employees.salary%TYPE;

    CURSOR c_salaries IS SELECT employee_id, salary employees

    If NOT EXISTS (SELECT 1 from employees e WHERE e.manager_id = employees.employee_id)

    and department_id = p_dep_id;

    CURSOR c_salaries_m IS SELECT employee_id, salary employees

    WHERE employe_id IN (SELECT distinct manager_id of employees)

    and department_id = p_dep_id;

    Start

    SELECT AVG (salary) IN the v_avg_sal FROM Employees WHERE department_id = p_dep_id;

    OPEN c_salaries.

    LOOP

    EXTRACT c_salaries INTO v_emp_id, v_sal;

    EXIT WHEN c_salaries % NOTFOUND;

    IF v_sal + 1 > 3 * v_avg_sal

    THEN UPDATE employees SET salary = 3 * v_avg_sal

    WHERE employe_id = v_emp_id;

    UPDATE of OTHER employees SET salary = salary * to_number ('1' |'.) ' || p_perc)

    WHERE employe_id = v_emp_id;

    END IF;

    END LOOP;

    CLOSE C_salaries;

    OPEN c_salaries_m.

    LOOP

    EXTRACT c_salaries_m INTO v_emp_id, v_sal;

    EXIT WHEN c_salaries_m % NOTFOUND;

    IF v_sal + 5 > 3 * v_avg_sal

    THEN UPDATE employees SET salary = 3 * v_avg_sal

    WHERE employe_id = v_emp_id;

    UPDATE of OTHER employees SET salary = salary * to_number ('1' |'.) ' || (p_perc + 50))

    WHERE employe_id = v_emp_id;

    END IF;

    END LOOP;

    CLOSE C_salaries_m;

    end RAISE_SALARY;

    Compile for HR.MILOS_PACKAGE BODY of PACKAGE errors

    Error: PLS-00323: subprogram or cursor "RAISE_SALARY" is declared in a package specification and must be defined in the package body

    We hear... you have defined the raise_salary procedure in the package specification but not in the package body. (pretty clear)

    not in the package body means:

    the statement could be different...

    PROCEDURE RAISE_SALARY (NUMBER, p_dep_id NUMBER p_perc)

    so:

    are identical named parameters?

    they have identical data types?

    vary according to the assigned default values?

    vary according to its use (IN/OUT/IN OUT) - (why did not specify the use anyway?)

    HTH

  • Procedure call to the procedure in one package

    Hello

    I need help to call a procedure within a package.

    I have an ABC package in which I have 3 X Y and Z I procedures I need to call the procedure procedure Y X that belongs to the same package.

    Thanks in advance

    I need to call the procedure procedure Y X that belongs to the same package.

    Just make sure that this procedure that is has been defined before the X procedure in the package body. However, there no need this if the two procedures are also defined in the package specification.

  • Can only establish us a specific procedure in the package body?

    Hi experts

    Say we have a package as follows:

    package my_package

    a procedure;

    procedure b;

    procedure c;

    end packege my_package;

    my_package package body

    procedure a

    is

    ....

    end;

    procedure b

    is

    ....

    end b;

    procedure c

    is

    ....

    c end;

    end of packet my_package;

    I want to only change the procedure has, should I compile the body together for this? Can I do to compile the procedure like the following?

    create or replace the my_package.procedure one

    is

    ....

    end my_package.a;

    Thank you

    Hello

    No, you must recompile the entire body.  There is no way to compile a procedure in the package.

  • How to check the column updated whereby the package or procedure?

    Hi all

    Can someone help me how to check the column updated by which the package or procedure

    A.Mahesh

    Hello.

    You can check what object is a reference to the table of the column:

    Select *.

    of all_dependencies d

    where d.REFERENCED_NAME = '. '

    And you can find all the links to the object source data column:

    Select *.

    of s all_source

    where s.name = "."

    and s.OWNER = '. '

    and s.TYPE = "."

    and as s.TEXT '%%'

  • Why we need to create the package instead of procedure or function in Oracle

    Hello

    Recently, I attended an interview, they asked,
    why we must create the package instead of procedure or function in oracle. Is a specific advantage, if we create together.
    I'm not sure. can u tell me please someone.

    Thank you and best regards,
    Sanjeev.

    Hello

    A part of the oracle documentation.

    What is a PL/SQL Package?
    A package is a schema object which includes subroutines, variables, and logically related PL/SQL types. Packages have two parts: a specification (spec) and a body. Sometimes, the body is unnecessary. The specification is the interface to the package. It declares the types, variables, constants, exceptions, cursors, and subprograms that can be referenced from outside the package. The body defines queries for the sliders and the code for the subprogrammes.

    Benefits of the PL/SQL Packages
    Packages have a long history in software engineering, offering important characteristics for a reliable, maintainable, and reusable code, often in team for large systems development efforts.

    Modularity

    Packages allow you to logically encapsulate Associates types, elements, and subroutines in a module named PL/SQL. Each package is easy to understand, and the interfaces between packages are simple, clear and well defined. This facilitates the development of applications.

    Easier application design

    When you design an application, all you need initially is the interface information in the package specification. You can code and compile a spec without his body. Stored subprograms that reference the package can then be compiled as well. You should not set the package body entirely until you are ready to complete the application.

    Information masking

    With packages, you can specify which types, elements, and subprogrammes are (and accessible) public or private (hidden and inaccessible). For example, if a package contains four subprogrammes, three can be public and one private. The package hides the implementation of the subprogramme private so that only the package (not your application) is affected if the application changes. This simplifies maintenance and improvement. Also, by hiding the implementation details of the users, you protect the integrity of the packaging.

    Feature added

    Sliders and packed public variables persist for the lifetime of a session. They can be shared by all the subprogrammes that are running in the environment. They allow you to manage data in any of the transactions without storing in the database.

    Best performance

    When you call a subprogram packaged for the first time, the whole package is loaded into memory. Subsequent calls to related subprograms in package require no disk i/o.

    Packets stop cascading dependencies and avoid an unnecessary recompilation. For example, if you change the body of a packaged function, Oracle does not recompile other routines that call the function; These routines only depend on parameters and return value that are declared in the specification, so they are recompiled only if the specification changes.

  • How to get the name of the package to a procedure used in a workflow process activity

    Hi all. I'm on OWB 11.2.0.2.0.

    When I used a function or a procedure that is packed for a mapping operator, I can find the name of package.program_unit by getting FUNCTION_NAME property of the operator. For example,.
    OMBRETRIEVE MAPPING "$mapName" OPERATOR "$operName" GET PROPERTIES (FUNCTION_NAME)

    But when even is used in a workflow process activity, I can't find a property name that will give me the same information. I can get the BOUND_NAME, it don't tell me the name of the package. It must be stored in the properties of the activity because when you pull up to synchronize for the activity dialog box, he knows the name of package.

    Is it possible to get this via an OMBRETRIEVE?

    Thank you.

    Try this:
    OMBRETRIEVE PROCESS_FLOW 'PF_NAME' ACTIVITY 'PROCEDURE_NAME' GET REF
    It gives you the full path to the process/PROJECT/MODULE/PACKAGE. PROCEDURE
    Concerning
    ANA GH

  • grant user privileges for the execution of a procedure in a package

    Hi all

    My need is to grant privileges to User1 to run only a single procedure proc1 in package1.
    It is possible at all?
    Do I need to grant more privileges if procedure1 calls procedure2?

    Hello

    Marco wrote:
    OK, so I can create procedureN off package1 claiming enforcement procedureN package1.proc1 and grant privileges to User1.

    Is this possible without rights for package1.proc1?

    Yes, it is possible. If user_x has EXECUTE privileges on procedureN procedureN has DEFINE AUTHID (which is the default), then user_x doesn't have privileges on the packaging or the tables used in procedureN.

  • Check the package/procedure for a user level privileges

    Hi gurus,
    How to check the package/procedure for a user-level privileges? as dba_tab_privs for the tables.

    for example: grant execute on User1 dbms_scheduler.
    now I must verify that user1 has run on dbms_scheduler privilege or not.

    What is the advice for this?

    Thanks in advance,
    Charles
    SQL> select privilege, count(*) from dba_tab_privs group by privilege order by 1;
    
    PRIVILEGE                       COUNT(*)
    ---------------------------------------- ----------
    ALTER                               19
    DEBUG                              256
    DELETE                              131
    DEQUEUE                            3
    EXECUTE                           19315
    FLASHBACK                          52
    INDEX                               14
    INSERT                              137
    MERGE VIEW                          36
    ON COMMIT REFRESH                     52
    QUERY REWRITE                          52
    
    PRIVILEGE                       COUNT(*)
    ---------------------------------------- ----------
    READ                                7
    REFERENCES                          54
    SELECT                                3752
    UNDER                                3
    UPDATE                              111
    WRITE                                5
    
    17 rows selected.
    

    DBA_TAB_PRIVS is more than simple tables.

  • extract the package and the procedure name in the code

    In my treatment of exceptions, I need to register the name of package and procedure I have the exception. How can I get these two names without manually coding the names?

    Thanks to anticipiation

    A better option is to get the package name and the line number

    An even better option is to use the pl/scope (when you are in 11g (not sure about 10g)):

    SQL> alter session set plscope_settings='identifiers:all'
    /
    Session altered.
    
    SQL> set serverout on
    
    SQL> create or replace package pkg
    as
       procedure p1;
    
       procedure p2;
    end pkg;
    /
    Package created.
    
    SQL> create or replace package body pkg
    as
       procedure get_scope (obj varchar2, line int)
       as
       begin
          for c in (select rpad (lpad (' ', 2 * (level - 1)) || name, 20, '.') || ' ' || rpad (type, 20) || rpad (usage, 20) identifier_usage_contexts
                    from user_identifiers t
                    where level != 1
                    start with line = get_scope.line and object_name = obj
                    connect by usage_id = prior usage_context_id)
          loop
             dbms_output.put_line (c.identifier_usage_contexts);
          end loop;
       end get_scope;
    
       procedure p1
       as
       begin
          null;
       end p1;
    
       procedure p2
       as
       begin
          get_scope ($$plsql_unit, $$plsql_line);
       end p2;
    end pkg;
    /
    Package body created.
    
    SQL> exec pkg.p2
    
      P2................ PROCEDURE           DEFINITION
        PKG............. PACKAGE             DEFINITION
        PKG............. PACKAGE             DECLARATION
    PL/SQL procedure successfully completed.
    
  • fusion of procedures in the package and calling with common proc?

    Hello

    I wrote similar procedures... and I'm calling each procedure separately and transmitting his values...

    something like that
     
    
       begin 
       mov_tbl1(1234); 
       end 
    
    then again similarly for 
    
       begin 
       mov_tbl2(1234); 
       end;    
       
    My question is how to merge these two procedures in one package and call them with a common procedure and pass the value (var_id) once for procedures?
     
    create or replace procedure mov_tbl1 ( var_id number)  is 
             
             cursor tbl1_cur as 
             select  src.col1, 
                     src.col2, 
              from abc_tbl1 tbl1, 
                   abc_tbl2 tbl2 
              where tbl1.no = var_id  -- this is variable i m trying to make it as a paramter in common proc 
                    tbl1.id = tbl.id 
                   -- the record variable declaration is implicit in FOR LOOP 
          begin 
                for  tbl1_cur_rec  in tbl1_cur 
                loop 
                  begin 
                    insert into tgt.tabl1(col1,col2) 
                                values (tbl1_cur_rec.col1, 
                                    tbl1_cur_reccol2, 
                            ); 
                            exception 
                         when others then 
                           null; 
                  end; 
                end loop; 
          end; 
    
    
    create or replace procedure mov_tbl2(var_id number) is 
        
           cursor cur_tbl2 
             select col3,col4, col5 
               ...... 
             from abc_tbl1 tbl1, 
                   abc_tbl2 tbl2, 
                   abc_tbl3 tbl3 
            where   tbl1.no = var_id and   --this is variable i m trying to make it as a paramter in common proc 
                    tbl1.id = tbl.id and 
                    tbl2.dept = tbl3.dept 
              begin 
                  for ... 
                    loop ... 
                      insert into ... 
                         values.... 
             .... 
              end; 
      
    I m bit confused, if you want to use the parameter or parameter... .i am beginner in writing packages... :))
    Ideas or examples is greatly appreciated! Thank you very much!!

    Check if all parameters have been assigned to certain values.

    And call the procedure that is packaged with the following syntax.

    Begin
    .(parameter_value);
    end;
    
    i.e.
    Begin
    TEST_PACK.COMMON_PROC(1234);
    End;
    

    Can you post the code here so that we can have a look at what goes wrong.

    Here is a test package I ran

    PRAZY@11gR1> create or replace package test_pack as
      2  procedure common_proc(var_id number);
      3  end;
      4  /
    
    Package created.
    
    Elapsed: 00:00:00.00
    PRAZY@11gR1> create or replace package body test_pack as
      2  procedure private_proc1(var_id number) as
      3  begin
      4  dbms_output.put_line('FROM PROC1 :'||var_id);
      5  end;
      6
      7  procedure private_proc2(var_id number) as
      8  begin
      9  dbms_output.put_line('FROM PROC2 :'||var_id);
     10  end;
     11
     12  procedure common_proc(var_id number) as
     13  begin
     14  private_proc1(var_id);
     15  private_proc2(var_id);
     16  end;
     17
     18  end;
     19  /
    
    Package body created.
    
    Elapsed: 00:00:00.04
    PRAZY@11gR1> begin
      2  test_pack.common_proc(100);
      3  end;
      4  /
    FROM PROC1 :100
    FROM PROC2 :100
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.01
    

    Kind regards
    Prazy

Maybe you are looking for

  • Encrypted and signed e-mail are not displayed correctly

    Hello I managed to install a certificate from encryption of electronic mail on my Mac running OS X 10.11.4 but when I get an encrypted email and I open it in Mail it does not display security status, so there is no way of knowing that it is actually

  • Missing Motorola privacy settings?

    I was looking for some information on my phone and was referenced in a region called the privacy of Motorola in the settings. I could not find, and I saw somewhere that its supposed to be between the language input and backup & reset the options in t

  • Need to download the drivers from the Internet

    My compaq v5000 has no driver detection for internet I guess I deleted them by accident. So, how to install all drivers for internet? In my device manager it shows? Internet concerns so I need to know what to do?

  • Want 4500: Printer 4500 desire does not recognize my password wireless

    I bought a new printer 2 weeks ago - the installation was successful, and I was able to print several times on the wifi network. But for some reason any it stopped working a week later. I now have a blue light flashes next to the wifi on the printer

  • Live Mail missing the icon of the printer - how to make the toolbar

    My new laptop comes with WIndows & and Live Mail. I noticed tha your Live Mail Toolbar now is the printer icon in the toolbar - how I can get there?