procedure of package within a single package

can we call a package within a package procedure.

I have a package which has 2 procedure P1 and P2 and works. F1

F1 needs to use both P1 and P2.

Can I call P1 and P2 within F1. Do need to be called as pgkname. Even if they are inside the package P1?

Thank you

Yes, you can:

SQL> create or replace package my_pkg
  2  as
  3    function f1 return number;
  4  end;
  5  /

Package created.

SQL> create or replace package body my_pkg
  2  as
  3    procedure p1
  4    is
  5    begin
  6      dbms_output.put_line('Hi, I''m P1');
  7    end;
  8    procedure p2
  9    is
 10    begin
 11      dbms_output.put_line('Hi, I''m P2');
 12    end;
 13    function f1 return number
 14    is
 15    begin
 16      p1;
 17      p2;
 18      return 1;
 19    end;
 20  end;
 21  /

Package body created.

SQL> select my_pkg.f1 from dual;

        F1
----------
         1

1 row selected.

Hi, I'm P1
Hi, I'm P2

Look and find in:
This forum
http://www.Oracle.com/pls/db102/homepage
http://www.Oracle.com/pls/db112/homepage
http://asktom.Oracle.com

Tags: Database

Similar Questions

  • ORA-06508, procedure cannot call the procedure of package

    I have a large stored procedure that calls a package (procedure) that manages a number of procedures to determine whether the process can continue or not.  (It checks authorization of the student to enroll in a class).  We have a web process calling the stored procedure, and that works fine.  What does not work, is a call to the package.  Oracle returned ORA-06508: PL? SQL: could not find program unit called.

    I have included instructions for debugging, so I know that it is the specific call to a procedure in the package fails with ORA-06508.  Thinking it's perhaps something in the package, I inserted a debug statement as the first line in the procedure called in the package.    (Debugging instructions call a procedure inserts of rows in a table of debugging with independent validation).

    When I log in the user account with sqlplus and run a test, everything works fine.  But when the web process is running under the same user, the process fails to call the procedure of package and fails with ORA-06508.

    It seems as if the web process runs with the rights of the appellant, or a role is not granted.

    Can someone help me understand what the problem is?

    offered hv, I appreciate your comments.

    We solved the problem: remove the package that couldn't be cited, then re-create.   That's all!

    Apparently, something in the database was tangled upward.   The server recently had problems with disk space, then it might have been related to that.  But we'll never know for sure.

    The stored procedure and packaging (procedures) which he called were owned by the same schema, and there is no mechanism that I can find to prevent one of the other appellant.  But that was the case - Oracle threw the ORA-06508 exception when the stored procedure called the package procedure.

    I replaced the stored procedure and package several times fine-tuning debugging code, but this has not fixed the problem.

    Finally let it drop and then re-create the package, it's which solved the problem.

    Regarding requests to view the code, there is no way that I could reproduce the problem, since the error that occurred was against the permissions and rules which packages run and the procedures of the Oracle.  Thanks for all the tips and suggestions.

  • Error creating a salary. ORA-01422: exact fetch returns more than the requested number of rows in the hr_maintain_proposal_swi procedure insert_salary_proposal package

    Hi all

    We try to add new proposal for a salary of some employees from form August 1, 2015 (the Date of the beginning of employee)

    There is no existing salary proposal doesn't exist for these employees.

    We get below error.


    ORA-01422: exact fetch returns more than the requested number of rows in the hr_maintain_proposal_swi procedure insert_salary_proposal package


    Help, please.

    Thank you

    Tarun

    Hi John,.

    If it helps, take a look at the following note:

    ORA-01422 exact Fetch returns more than number of lines requested in Hr_maintain_proposal_swi (Doc ID 1673527.1)

    Kind regards

    Rajen

  • How to move the functions and procedures of packages in a schema?

    Hello

    I have less than the needs for a work at home and my question is if anyone can point me in the right direction to find documentation that can help me solve below. Any information will be appreciated. Thank you.

    Write procedures and functions (included or not in packets) as .txt or .sql scripts. Once they have been launched in Developer SQL they should, in addition, the functions and procedures of packages in the current schema. If the current schema contains only 2 packages, pac1 (p11, p12 procedures and functions f11, f12, f13) and pac2 (contains the p21 following procedures, p22, p23 and f21 and functions f21 (case of overload), running the scripts produce the following effects:)

    • Procedures p11, p12, p21, p22, p23, and f11, f12 and f13 functions will be created in the current schema.
    • PAC2 will contain 2 instances of the function of overload-f21; they will be kept in the package, without be created in the current schema. If all overloaded procedures/functions will be kept in their original packaging
    • If pac1 contains variables, cursors, and public types, keep us only the details of the package (and remove the body); usually if the packages contain no overloaded functions or procedures the body will be removed and if no variable, cursors, types of public then we will remove the header.
    • If in the triggers, procedures and functions we will call procedures/functions packages (procedures and functions moved into the current schema) they reference will need to be updated (via editing the body or recompilation) for example if pa1.p12 will be replaced with p12.
    • Scripts must have numbers in the next series (01... n) and the characters that explain the content.

    My only advice would be to remember that these are public forums and if YOU can find them, therefore cannot your instructors.

    In addition, those are horrible procedure names and function

    This mission seems to be around to overload the pl/sql objects and... prioritize a research on Oracle documentation around overhead and legacy
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28371/adobjplsql.htm#i21148

  • Updated APEX collection error ORA-04044: procedure, function, package, type

    Hi all

    I am trying to update the APEX MEMBER of the COLLECTION and encounter errors:


    1 error has occurred
    ORA-06550: line 9, column 8: PL/SQL: ORA-04044: procedure, function, package or type is not allowed here ORA-06550: line 7, column 3: PL/SQL: statement ignored

    The PLSQL code are as below

    DECLARE
    entire x;
    v_date_started VARCHAR2 (255);
    v_date_finished VARCHAR2 (255);
    BEGIN
    SELECT c.seq_id
    X
    OF APEX_COLLECTION c
    WHERE collection_name = "PHASE_COLLECTION."
    AND c001 =: P41_MPM_ID
    and rownum = 1;
    v_date_started: =: P41_DATE_STARTED;
    v_date_finished: =: P41_DATE_FINISHED;

    APEX_COLLECTION. () UPDATE_MEMBER
    p_collection_name = > 'PHASE_COLLECTION '.
    , p_seq = > x
    , p_c004 = > v_date_started
    , P_c005 = > v_date_finished
    );
    END;


    The process will take place after SUBMIT and validation.

    The code I used to add a colletion APEX will work perfectly and is as below

    -Initialization Collection PHASE_COLLECTION
    BEGIN
    IF THIS ISN'T APEX_COLLECTION. COLLECTION_EXISTS('PHASE_COLLECTION') THEN
    APEX_COLLECTION. CREATE_COLLECTION ('PHASE_COLLECTION');
    ON THE OTHER
    APEX_COLLECTION. TRUNCATE_COLLECTION ('PHASE_COLLECTION');
    END IF;
    -Add members to the COLLECTION PHASE of table PHASE_MEMBERSHIP
    IF: P41_MPM_ENG_ID IS NOT NULL THEN
    FOR x IN (SELECT mpm_id, mpm_eng_id, phase_number, date_started, date_finished, date_created
    OF phase_membership
    WHERE mpm_eng_id =: P41_MPM_ENG_ID
    AND active = 1
    ORDER BY date_created)
    LOOP
    APEX_COLLECTION. ADD_MEMBER
    (p_collection_name = > 'PHASE_COLLECTION')
    , p_c001 = > x.MPM_ID
    , p_c002 = > x.MPM_ENG_ID
    , p_c003 = > x.PHASE_NUMBER
    , p_c004 = > x.DATE_STARTED
    , p_c005 = > x.DATE_FINISHED
    , p_c006 = > x.DATE_CREATED

    );
    END LOOP;
    END IF;
    EXCEPTION
    WHILE OTHERS THEN
    Logger.Error (p_message_text = > SQLERRM)
    , p_message_code = > SQLCODE
    , p_stack_trace = > dbms_utility.format_error_backtrace
    );
    LIFT;
    END;


    What I tried to use APEX_COLLETION to check the overlap between the date_range.
    The requirement is just to display a warning if the user adds a record to the new phase or update record of current phase may overlap between the order of phase together.
    Table PHASE_MEMBERSHIP script is

    CREATE TABLE 'PHASE_MEMBERSHIP '.
    (
    ACTIVATE THE "MPM_ID" NUMBER NOT NULL,
    ACTIVATE THE "MPM_ENG_ID" NUMBER NOT NULL,
    ACTIVATE THE "PHASE_NUMBER" NUMBER (2.0) NOT NULL,
    "DATE_STARTED" DATE NOT NULL ACTIVATE.
    DATE OF THE "DATE_FINISHED."
    'NOTES' VARCHAR2 (2000 BYTE),
    'DATE_CREATED' DATE NOT NULL ACTIVATE.
    ACTIVATE THE 'CREATED_BY' VARCHAR2 (20 BYTE) NOT NULL,
    NUMBER (2.0) 'ACTIVE' DEFAULT 1 ACTIVATE NOT NULL)

    So, basically, I want to fill the documents associated with a particular to a collection of APEX called PHASE_COLLECTION MPM_ENG_ID.
    Then when the user specify date_started and date_finished, it will update/insert the APEX collection first.
    Then the rank based on audit collection date
    http://www.Oracle-base.com/articles/Misc/overlapping-date-ranges.php
    then display the warning to ask the user to confirm message.

    But then I'm stuck at the step of updating COLLECTION of APEX.

    If anyone has any ideas on what is wrong, please help.

    Thanks in advance.

    Ann

    Your syntx error line number should give you the trick - it is not a member of the update, rather the SQL - you are referring to apex_collection, not apex_collections view dictionary.

    Scott

  • Calling a procedure of package with only Date setting

    Hi all

    Please, help me to call a procedure of package with Date from the sql command prompt parameter.


    Arif

    Check the procedure below.

    SQL> ed
    Wrote file afiedt.buf
    
      1  create or replace procedure procdate (p_date_in date)
      2  is
      3  p_date_out date;
      4  begin
      5  p_date_out := add_months(p_date_in,6);
      6  dbms_output.put_line(p_date_out);
      7* end;
    SQL> /
    
    Procedure created.
    
    SQL> exec procdate('01-JAN-2010');
    01-JUL-10
    
    PL/SQL procedure successfully completed.
    
    SQL> exec procdate(to_date('01/01/2010','DD-MM-YYYY'));
    01-JUL-10
    
    PL/SQL procedure successfully completed.
    
    SQL> exec procdate('31-DEC-2010');
    30-JUN-11
    
    PL/SQL procedure successfully completed.
    
  • How to query the DDL lock functions or stored procedures and packages?

    Hello!

    The subject says it all: how to display existing DDL locks on the functions or stored procedures and packages?

    While running a procedure, it cannot be deleted or replaced, so there must be a DDL lock on it. The information does not seem to be in V$ LOCK or V$ LOCKED_OBJECTS.

    Thank you!
    Marcus

    Published by: David on November 21, 2009 15:43

    Hello

    You have the DBA_DDL_LOCKS view.

    Best regards
    Jean Valentine

  • Procedure runs package Help

    Hello

    I need to get familiar with the procedures and packages if I put in place the code below in a procedure to run a package, when to use the DBMS_OUTPUT procedure. Put_line to display that returns the package.

    Finally the package returns lines of our ColdFusion Oracle database.

    Could someone please help me get it going, and maybe I'll see where I am in foul territory? I think I'm close or across the universe.

    Thanks in advance for your help,

    Lou

    PROCEDURE
    create or replace
    PROCEDURE test2
    is
    TYPE my_cursor is REF CURSOR;


    BEGIN
    test1_pack.test1_proc(:my_cursor);
    LOOP
    NULL;
    -DBMS_OUTPUT. Put_line(my_c.col1 || my_c.col2);
    END LOOP;

    END test2;

    PACKAGE
    create or replace
    package test1_pack as

    TYPE test1_cursor IS REF CURSOR;

    PROCEDURE test1_proc)
    p_cursor in THE test1_cursor);

    end test1_pack;


    PACKAGE BODY
    create or replace
    package body test1_pack as

    PROCEDURE test1_proc)
    p_cursor in THE test1_cursor) as
    Start
    OPEN FOR P_cursor
    SELECT * FROM
    (SELECT 'Is' today AS "COL1", TO_CHAR (SYSDATE) AS 'COL2' FROM DUAL
    UNION ALL
    SELECT 'April', ' crazy! OF THE DOUBLE
    );
    end test1_proc;

    end test1_pack;

    Hello

    Try this:

    CREATE OR REPLACE PROCEDURE test2 IS
       TYPE my_cursor IS REF CURSOR;
       v_cursor my_cursor;
       v_col1   VARCHAR2(100);
       v_col2   VARCHAR2(100);
    BEGIN
       test1_pack.test1_proc(v_cursor);
    
       LOOP
          FETCH v_cursor
             INTO v_col1, v_col2;
          EXIT WHEN v_cursor%NOTFOUND;
          DBMS_OUTPUT.PUT_LINE(v_col1 || v_col2);
       END LOOP;
    
       CLOSE v_cursor;
    END test2;
    /
    

    Kind regards

  • Is it possible, both within a single segment dhcp servers?

    1 segment 2 dhcp server? It's possibe?

    It is possible, two within a single segment dhcp servers?

    and what about dhcpv4 may provide the client with ipv6? There is a possibility?

    I hope you help...

    Hello

    Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the Technet Forum. You can follow the link to your question:
    http://social.technet.Microsoft.com/forums/en-us/w7itpronetworking/threads

    Hope that helps.

  • Chapter numbers automatic for chapters within a single document

    I just got a question from a reader of my VQS. He wants to know how to "capture" the chapter number and chapter title to my chapters for footers in the document.

    I know how to make a model that is used for every single document that each chapter. These documents are collected in a book. Chapter numbers are set to "Automatic chapter numbering."

    But chapter numbers can only increase if documents are separate files assembled in a book. (At least, I think it's true.)

    But what happens if circulate you a paper with all the chapters within this single file? How to set chapter numbers to change automatically for footers? I suspect that you would need a variable text style paragraph or character as a footer. But how you get chapter numbers advance automatically?

    Would you use the bullets and numbering in the paragraph style?

    I know how to do these. I wonder what people would do for their workflow.

    You're right about the automatic chapter numbers - it's just one per doc.

    I think that I use a separate running header (character style) variable and try to pick up the number in the title of the chapter, if it is there or add a number of non-printing 'tag' on the first page of each chapter, if it is not.

  • Fault tolerance is possible within a single host?

    Fault tolerance is possible within a single host?

    My requirement is to create two virtual machines within a single host and high availability between these two VMs.

    Please suggest a solution.

    You will not be able to fulfill this requirement through VMware FT, this feature requires a minimum of 2 host.  you'd have to consider third-party solutions to meet your specific needs

  • Procedure in package - unique all of the benefits of performance?

    We have generally a practice of holding procedures similarly module you which deals with the same features so-called consecutively in the same package.
    We know that what we do for performance benefits,
    because once a procedure inside a package is called, the whole package with all its procedures is responsible for memory, then it improves performance when we also work with other procedures in the package, DISK_READS probably decreases,

    But I have a question here.
    Suppose that I have a single autonomous procedure.
    And I the same, written procedure within a package, just a single procedure, written inside the package.
    Is there any kind of delivery?

    Manuella,

    One of the advantages is that you have more maintainable and reusable code.

    Consider that you are looking for a feature to convert a string to a table. and if it is not available in the oracle supplied packages, you decide to move forward and your own utility function str2table wite.

    Rather than create a standlone function, if you create it as a package... whenever someone in the team comes up with a custom utility requirement, it would be to add it to the package as wel. In this way over a period of time, before anyone writes a function utiity, he would know exactly where to look. It's a pretty good way to keep the code and help people to reuse the code that you have written useful packaging these procedures.

    Thank you
    Rajesh.

  • How to use the record type as a parameter IN PL/SQL procedure or package

    Hi people,

    I need help on the record as the OUT parameter type. I am able to get out a single line as a parameter, but not getting do not idea how to get a multi ranks as output parameter.

    I have the code that works very well for a single line. Please see CODE1.

    But when I try to get several lines, I'm failing to do. Please see the CODE2. I get the error of compilation as


    Error report:

    ORA-06550: line 11, column 35:

    PLS-00487: Invalid reference to the variable "P_NAME.

    ORA-06550: line 11, column 1:

    PL/SQL: Statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    Any help or a sample execution of script would be really useful.

    Thanks in advance.

    YZ

    --------------------------CODE1------------------------------------------

    -------------------------Package Spec-------------------------------

    CREATE OR REPLACE

    PACKAGE xx_sample_pkg as

    --

    Xx_sample_table_rectype RECORD TYPE IS

    (p_name varchar2 (40))

    number of p_emp_id

    );

    PROCEDURE xx_sample_prc (xx_sample_rec1, OUT xx_sample_table_rectype);

    END xx_sample_pkg;

    ------------------------------Package Body------------------------

    create or replace

    PACKAGE xx_sample_pkg AS BODY

    --

    PROCEDURE xx_sample_prc (xx_sample_rec1 OUT xx_sample_table_rectype) IS

    BEGIN

    SELECT ename, empno

    IN xx_sample_rec1

    FROM scott.emp

    WHERE ename = 'SMITH ';.

    END xx_sample_prc;

    END xx_sample_pkg;

    -------------------------------------------Execute----------------------

    DECLARE

    l_rec_type xx_sample_pkg.xx_sample_table_rectype;

    BEGIN

    dbms_output.put_line ('xx_sample_prc appeal');

    xx_sample_pkg.xx_sample_prc (l_rec_type);

    dbms_output.put_line ('YZ' | l_rec_type.p_name |') '|| l_rec_type.p_emp_id);

    END;

    ---------------------------------------------------------------

    -------------------------CODE2-------------------------------------------

    -------------------------Package Spec-------------------------------

    CREATE OR REPLACE

    PACKAGE xx_sample_pkg as

    --

    Xx_sample_table_rectype RECORD TYPE IS

    (p_name varchar2 (40))

    number of p_emp_id

    );

    PROCEDURE xx_sample_prc (xx_sample_rec1, OUT xx_sample_table_rectype);

    END xx_sample_pkg;

    ------------------------------Package Body------------------------

    create or replace

    PACKAGE xx_sample_pkg AS BODY

    --

    PROCEDURE xx_sample_prc (xx_sample_rec1 OUT xx_sample_table_rectype) IS

    BEGIN

    SELECT ename, empno

    IN xx_sample_rec1

    FROM scott.emp;

    END xx_sample_prc;

    END xx_sample_pkg;

    -------------------------------------------Execute----------------------

    DECLARE

    l_rec_type xx_sample_pkg.xx_sample_table_rectype;

    BEGIN

    dbms_output.put_line ('xx_sample_prc appeal');

    xx_sample_pkg.xx_sample_prc (l_rec_type);

    for l_rec in 1.l_rec_type.p_name.count

    loop

    dbms_output.put_line ('YZ' | l_rec_type.p_name (l_rec) |) » '|| l_rec_type.p_emp_id (l_rec));

    end loop;

    end;

    ---------------------------------------------------------------

    bb8c573a-6ca3-4d7c-90ed-e55c2df67201 wrote:

    But now, my question would be why the record type could not be used? My understanding is missing some concept between use of type type array collection record vs. Please specify.

    Do not confuse the folder with the collection.

    SY.

  • Two environments, the same procedures and packages

    Hello world

    I developed some packages, scenarios, Interfaces, procedures and Variables.

    Everything works fine, BUT I have to environments: development and Production.

    Whenever I want to use these object on ODI on my table, I have to change the background on every single procedure, re - run the Packages and then cross your fingers :-)

    Is there an easier way to do this? I already have to duplicate all the mention of the object above and made focus them to different contexts, but I hope that there is a better way to solve this problem.

    I really appreciate your ideas, comments, suggestions, etc.

    Do not hesitate to contact me if more details are needed.

    Best regards.

    J_ORCL

    Do not define the contexts explicitly in the process objects, leave the context in the execution context. All your procedures will then use the context you specify the runtime and therfore set you only once the context.

  • 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

Maybe you are looking for

  • Update iOS 9.3.2 - password iCloud could not recall

    Since the update to iOS 9.3.2 my iPad keeps asking my iCloud/Apple ID password.  After having put in it, it makes me enter my recovery key and set a new password.  This was repeated atleast doing times so far.  Is that what the problem of ideas? Than

  • Satellite A210 FS3, PSAFGC-FS308C. BIOS update gone wrong.

    Hi all I'm looking for info on my laptop satellite who died after a bios update. Model is A210-FS3 (PSAFGC-FS308C)... bios uncertain. I updated this laptop about 6 months ago (been dormant since) through windows7 beta (I know bad idea)... after he st

  • Image sizes

    I did a forum search but it lead me to anything about my question, so here I am. I am shooting pictures everywhere, the place and I noticed when I'm ready to download to tell Webshots, sizes range from 64K to 1.4 MB, even if my camera image resolutio

  • XP games

    I have XP Professional, it came with no games installed, how/where can I find to download free?

  • How to find the computer and hostname to get remote access?

    Original title: remote accessWhere I would look for a hot name and cmputer get remote access.