Difference of procedure package Vs

In addition to an overload and private subprogrammes, what is the advantage of the procedure/function created within a packet on Stand Alone procedures in terms of performance.

What will be the difference in the behavior of stand-alone procedure/function and procedure/function inside the package if both are called by 100 different user one by one. Will the charge procedure 100 times for each call or not?

Can someone give me more clearity on these points:

Best performance - packages can be compiled and are loaded into memory in full and not piecemeal as other methods. This advantage if at all there is minimal compared to other services.

Invalidation reduced - change a package body does not invalidate the dependencies to change a function or procedure.

Hello

Kimmy says:

Thanks for the links that I read the post before and then I posted this discussion for more clearity...

Any code that is executed is loaded into the Cache of the bookstores and remain in the library Cache until it is aged by the LRU algorithm. So if there are a 100 calls to a stand alone procedures be there in the Cache/memory?

If not why not?

If Yes... So how this behavior differs from the behavior of charge of the public procedure within a package?

There is nothing special about 100 calls.  A procedure (or package) might be aged after 1 call or after 100 calls, or it can remain in cache after 1 call or after 100 calls.

The difference between stand-alone procedures and packages in this regard is that all remains in the cache, or gets old, together.  So if you have requested that a procedure in the package, as this package is cached, then the 1st time you call another procedure in this package it will already be in memory.

Other differences between packages and stand-alone procedures:

A package can have variables and types defined in package specifications and so can be used by other users.  (With the help of ouutside of package variables to the package, instead of using functions, maybe not a good idea, however.)

Change a package body is invisible to dependent objects.  If you change just the package body, no other packages or views will be become disabled or need to be recompiled.

Tags: Database

Similar Questions

  • What is the difference between the package from photography to Photoshop and Photoshop on his own? Photography Photoshop has the same capabilities as the single app?

    What is the difference between the package from photography to Photoshop and Photoshop on his own? Photography Photoshop has the same capabilities as the single app?

    Hello

    Greetings!

    Photography package to include Photoshop and Lightroom.

    However, if you choose Photoshop as a single application you get 20 GB of cloud while in terms of photography, you get 2 GB of cloud.

    Plan of photography is less expensive than the only application.

    Check here: https://creative.adobe.com/plans

    Concerning

    Jitendra

  • I can compile new procedures/packages on my instant watch?

    Hello

    I can compile new procedures/packages on my watch to the snapshot ?
    I need to test the new version of the application, which include some changes to the current packages

    Thank you

    Yes, that's the purpose of the eve of the snapshot
    You can test your application with real data
    When you are finished, all changes will be devulcanization (flashback), and the standby database will follow the new primary side

  • What is the difference between procedure and function?

    Hello
    I want to know the difference between procedure and function.
    Also, I want to know the types (if any) of procedures and functions.

    Concerning

    A function requires a return value.

    A procedure, while allowing the option PARAMETERS, mandates without return.

  • Identify the name of the schema in a procedure/package

    My google-fu is totally miss you on this one and I have a method for doing this already, but there is an insidious sense that there is a better way to do it there.

    Basically I have two schemas that have the same procedures, packages, etc. in them (separate for reasons of risk; leaves do not enter the problem of duplication of code to maintain...!) and in a few, there are references to the schema to which belongs the package/proc/function (for example for analysis of tables). In order to avoid the schema name and the nightmare of maintaining different publication for different schemas, hard coding scripts I want to code in order to determine which schema it runs under.

    I can't use 'USER' as which shows the user connected, and I want the name of the owner of the code being run.

    I came with:
    select username from user_users;
    but as I said, I can't help but feel that there is a better way.

    Is there, and if there is, what is it please?

    This?

    sys_context (' USERENV', 'CURRENT_SCHEMA' ")

  • Procedures package

    Hello

    When I run my packege it inserts records form Employees table to the new_emp table. And if I pass the parcel second time it inserts the same records that were inserted. So I get duplicate records.

    How to avoid duplication of discs?

    create or replace

    package emp_pac as

    procedure ins_emp (employee_id number);

    end emp_pac;

    create or replace

    package body emp_pac as

    procedure ins_emp (employee_id number, sal_id number) as

    Start

    insert into new_emp (employe_id, FIRST_NAME, LAST_NAME, EMAIL,

    PHONE_NUMBER HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID)

    SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL,

    PHONE_NUMBER HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID

    Employees;

    ins_emp end;

    end emp_pac;

    Hello

    -all employees to new_emp load line

    INSERT INTO new_emp

    ...

    Employees WHERE NOT EXISTS)

    SELECT null FROM new_emp WHERE employe_id = employees.employee_id

    )

    -If you add condition while the lines are candidates for the copy (if not copied already copies)

    AND employee_id = p_employee_id

    Note that I added the prefix p_ your parameter for clarity!

  • Difference of procedure & function

    Hi all

    After citing some tutorials, I got to know that the difference between the procedure and the function is that the procedure may or may not return a value as the function must return a value to the calling program. Given below is my procedure. & He would compare the lower of the two numbers would be smaller than

    create or replace procedure findmin

    (

    x in number,

    there in numbers,

    z series

    )

    is

    Start

    if(x<y) then

    z: = x;

    on the other

    z: = y;

    end if;

    end;

    declare

    c number;

    Start

    findmin (23,45,c);

    dbms_output.put_line (c);

    end;

    Here's my function even if it does the same thing.

    create or replace function findmin_fun

    (

    x in number,

    y number

    )

    Return number

    is

    number of z;

    Start

    if(x<y) then

    z: = x;

    on the other

    z: = y;

    end if;

    Return z;

    end;

    declare

    Start

    dbms_output.put_line (findmin_fun (56,28));

    end;

    I would like to know under what are all the scenarios of the procedure and function would be used. And also I want to know could do dml as insert, update, and delete operations

    If so, could you guys explain me with some examples to expose DML operations on functions

    After citing some tutorials, I got to know the difference between the procedure & function is that the procedure may or may not return a value as the function must return a value to the calling program.

    Not quite.

    A procedure does NOT return a value - it can fill in the parameters OUT or INOUT but which is NOT considered to be "of return values.

    A function ALWAYS returns a value that can be null. The only exception is if the function throws an exception.

    My procedure is given below. It would be to compare the lower of the two numbers & would mean that smaller

    Not quite - the procedure returns NO value. You use it to try to fill one OUT parameter, but it's NOT the same.

    I would like to know under what are all the scenarios the procedure & function would be used.

    Functions can be used in SQL; procedures cannot be used in SQL.

    The functions return a value; procedures of does NOT return a value.

    Use the functions when you need to return a value; Use the procedures when you do NOT need to return a value.

    It is not possible to list 'all scenarios' for one or the other, because there may be ANY NUMBER of possible scenarios.

    And also I want to know could do dml as insert operations, update & delete

    What happened when you tried?

    The best and fastest, to learn is to actually TRY THINGS. Don't be afraid to break the Oracle by actually writing code and tests of things yourself.

    If so, could you guys explain me with some examples to expose DML operations on functions

    The Oracle documentation have a LOT of examples of using functions and procedures and include the code of the example.

    https://docs.Oracle.com/CD/E11882_01/AppDev.112/e25519/subprograms.htm#CHDBEJGF

    The internet has even more examples of code.

  • dbAdapter fails during the call to procedure package oracle object type in the parameter out

    JDeveloper 1.1.1.6

    Oracle 11g

    Existing package procedure is defined with the table of objects in input parameters and.

    Package myPackage

    procedure processRecon (numero_projet VARCHAR2,

    INST_ID select NUMBER,

    recon_type VARCHAR2,

    gis_design_stock GMPVT. GMPVT_GIS_DESIGN_STOCK_T,

    stock_uop GMPVT. GMPVT_STOCK_CODES_T,

    x_status OUT VARCHAR2,

    x_escalation OUT VARCHAR2,

    x_recon_error ON GMPVT. GMPVT_GIS_RECON_ERR_T) IS

    GMPVT. GMPVT_GIS_RECON_ERR_T is an array of GMPVT objects. GMPVT_GIS_RECON_ERR, who has 12 fields including the new I added it.

    I have added a new field to the GMPVT object. GMPVT_GIS_DESIGN_STOCK, where GMPVT. GMPVT_GIS_DESIGN_STOCK_T is a table of GMPVT. GMPVT_GIS_DESIGN_STOCK, no problems encountered during the test.

    Next, I added a new field for the object of type GMPVT. GMPVT_GIS_RECON_ERR, the following error below occurs when the DBAdapter is called

    < Summary > Exception occurred when the link was invoked. Exception occurred during invocation of the JCA binding: "JCA binding run operation 'processStockRecon' failed due to the reference: Interaction processing error." Error in the processing of applications from running. GMP_SOA_RECON_PKG. Interaction of the PROCESSRECON API. An error occurred during the processing of the interaction to invoke APPS. GMP_SOA_RECON_PKG. PROCESSRECON API. Cause: java.lang.ArrayIndexOutOfBoundsException: 12 check to make sure that the XML file containing the data of the parameter matches the parameter definition in the XSD. This exception is considered non reproducible, probably due to an error of modeling. ". The called JCA adapter threw an exception of resource. Please review the error message above carefully to determine a resolution. < / Summary >

    I confirmed that the XSD for the stored procedure has in fact change, which has been generated by JDeveloper as I refreshed the database adapter.

    The statement "Cause: java.lang.ArrayIndexOutOfBoundsException: 12" I can't that assume somehow SOA has 12 parameters but the 12 setting was not saved.

    Any thoughts on what I might be missing. I can provide more information if necessary.

    Hello

    This problem has been resolved. Not deployed SOA composite and then deployed to the server of the SOA. For some reason, SOA has been either you see does not changes in the file XSD (cached?) or the XSD was not get updated.

    Thank you

  • Calc Manager differences Sub procedures

    Hi guys,.

    I was looking for the scripts for the rules in the Manager of Calc and noticed that any set of rules are of use (even if they are included in the routine of SubCalculate).

    From the point of view of a traditional .rle file, what are the differences? Are there changes when you use a sub procedure in the SubCalculate routine? As far as I know, there is no change.

    Thank you!

    Kind regards

    L.

    Manager of Calc's all simply a user interface for creating rules HFM, and therefore the traditional major subroutines continue to apply:

    -Calculate
    -Translate
    -Consolidate
    -Dynamic
    -Entry
    -NoInput
    -Allocate
    -Transaction
    -Capital own Pick Up

    Certainly when writing rules we can create more custom subroutines in subroutines main HFM above, but Calc Manager does not change this feature at all.

    -Chris

  • Cannot call procedure/package wwv_flow_load_data.create_csv_collection

    Hello

    I have a pl/sql code in a process page that calls a procedure in a package. He worked at point 3.1, but does not work in 4.0.1.00.03.
    declare
      l_first_row_is_col_name boolean := true;
      l_file_id               number := 0;
    begin
      select id
        into l_file_id
        from apex_application_files
       where name = :P50_FILE;
    
      :P50_FILE_ID := l_file_id;
    
     wwv_flow_load_data.create_csv_collection (
      p_file_id                => l_file_id,
      p_separator              => ',',
      p_enclosed_by            => '"',
      p_first_row_is_col_name  => l_first_row_is_col_name,
      p_currency               => '$',
      p_numeric_chars          => '.,',
      p_charset                => 'utf-8'
      );
    end;
    {code}
    
    here is the error:
    
    ORA-06550: line 12, column 2:
    PLS-00201: identifier 'WWV_FLOW_LOAD_DATA.CREATE_CSV_COLLECTION' must be declared
    ORA-06550: line 12, column 2:
    PL/SQL: Statement ignored
    
    1. declare
    2.   l_first_row_is_col_name boolean := true;
    3.   l_file_id               number := 0;
    
    
    It seems that the package/procedure is not valid so it is being interpreted as a variable, but it is valid in the schema APEX_040000.
    
    Any suggestions are appreciated.
    
    Thanks
    Matt                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    Hello

    I think that there is no synonym public wwv_flow_load_data.
    You must create an and control the privileges for the apex_040000.wwv_flow_load_data package.

    That is obviously not recommended because wwv_flow_load_data is the package without papers.

    Kind regards
    Jari

  • Security procedures/packages. Hide source code?

    Hello.

    I was wondering if it is possible to hide the source code of a procedure for a user or to avoid him to recreate it, but leave it to run it.

    Im doing a procedure of Lac sand which modify and run an external task. It works fine, but I see a lot of security holes. If any DB user who can execute this procedure can change too, they could run any command shell by modifying the attributes of external work. I could use the credentials (11.2.0.2) and somehow limit the use of the system to specific orders, but I want to fix the security hole by limiting the user DB limiting rather the user of the system.

    It is the external work
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB(
    job_name => 'test',
    job_type => 'EXECUTABLE',
    job_action => '/bin/sh',
    number_of_arguments => 2
    );
    
    DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
    job_name => 'test',
    argument_position => 1,
    argument_value => '-c'
    );
    
    DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
    job_name => 'test',
    argument_position => 2,
    argument_value => '/bin/date>>/tmp/date.log'
    );
    END;
    / 
    And then the procedure.
    CREATE OR REPLACE PROCEDURE TEST_DATE_FILE ( new_file IN varchar2 )
    IS BEGIN
    DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
    job_name => 'test',
    argument_position => 2,
    argument_value => '/bin/date>>/tmp/' || new_file
    );
    
    DBMS_SCHEDULER.RUN_JOB(
                                    job_name =>             'test',
                                    use_current_session =>  TRUE
                                    );
    END;
    /
    --
    SQL > conn scott/tiger
    Conectado.
    SQL > exec TEST_DATE_FILE('newfile.log');

    Procedure-PL/SQL terminado correctamente.

    SQL > CREATE OR REPLACE PROCEDURE SYS. TEST_DATE_FILE (new_file IN varchar2)
    2. IS BEGIN
    3 DBMS_SCHEDULER. () SET_JOB_ARGUMENT_VALUE
    job_name 4 = > 'test ',.
    5 argument_position = > 2,
    argument_value 6 = > "rm - rf/bin / / tmp / *'"
    (7);
    8
    9 DBMS_SCHEDULER. () RUN_JOB
    job_name 10 = > 'test ',.
    11 use_current_session = > TRUE
    (12);
    13 END;
    14.

    Created procedure.

    SQL > exec TEST_DATE_FILE (' ');

    Procedure-PL/SQL terminado correctamente.

    --

    It is possible to hide the source code of the procedure that edits and run the external procedure?
    There is no work around or any idea how I can avoid this?

    Concerning

    Published by: elvegaa_esp on 17-may-2012 02:41

    Published by: elvegaa_esp on 17-may-2012 02:43

    [email protected] > host wrap iname = test.sql oname = test_wrap.sql

    PL/SQL Wrapper: Release 8.1.7.2.0 - Production on Mon Jan 07 12:44:21 2002
    Copyright (c) 1993 Oracle Corporation, 2000. All rights reserved.
    Test.sql to test_wrap.sql treatment

    [email protected] > @test_wrap.sql
    [email protected] > create or replace procedure wrapped p
    2 0
    3 abcd
    4 abcd
    5-abcd
    6 abcd
    7 abcd
    8 abcd
    9 abcd
    10 abcd
    11-abcd
    12 abcd
    13 abcd
    14 abcd
    ABCD 15
    ABCD 16
    17 abcd
    18 3
    19 7
    20 8106000
    21 1
    22 4
    23 0
    24 4
    25 2: e:
    26 1 P:
    27 1DBMS_OUTPUT:
    28 1PUT_LINE:
    29 1Hello world:
    30 0
    31
    ...
    86.

    Created procedure.

    and now you do not have

    [email protected] > select text from user_source where name = 'P ';

    TEXT
    ----------------------------------------------------------------------------------------------------
    -------------------------------
    procedure wrapped p
    0
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    ABCD
    3
    7
    8106000
    1
    4
    0
    4
    2: e:
    1 P:
    1DBMS_OUTPUT:
    1PUT_LINE:
    1Hello world:
    0
    ...

    [email protected] >

    Published by: human Chen on May 29, 2012 11:26

  • Difference between the use of IS and HAVE when creating a Package or procedure

    Hello

    Has had an interview in one of the company.

    They asked me that, "What is the difference between IS and as in the creation of package or Stored Procedure Usage?".

    I checked the package creation with same IS and YOU, but there is no problem.

    Kindly clarify me on this.

    Many thanks in advance.

    Kind regards
    Shiva

    961805 wrote:

    If this is the case, why oracle is allowing us to use and HAVE? Instead he could have allowed us to use AS single.

    No. I like IS more What did. Not to mention what the Ada (the mother of PL/SQL language), use.

    PL/SQL is allow that you use IS or ACE.

    A possible reason for PL/SQL support this, is influence of syntax for the SQL language. The ANSI SQL syntax uses YOU. And the SQL language can be used natively inside code PL, due to the integration of SQL, PL/SQL.

    Use IS or ACE.

    Many (?) use definitions of package fror YOU and IS for the definitions of the procedure and function. Not necessary from a perspective of language syntax, but serves to highlight the differences between a package signature and that of the procedures, functions, and methods.

  • Backup Tables, triggers and packages/procedures

    Oracle 11.2 and Developer SQL 3.2.

    For the backup of the data, I use OEM/Rman to schedule a backup.  My understanding, these are usually data only (physical backup).

    Now, I want to make the backup of the logic for the tables, packages/procedures and triggers.  I currently use Oracle SQL Developer to export as separate SQL files.

    I wonder if there are any other options to save the tables, procedures and triggers?

    Currently I am guard three types of backups:

    (1) creation of user scripts, role and grant the user privileges.

    (2) tables, packages/procedures and triggers saved via Oracle SQL Developer

    (3) data ora saved through OEM

    Total crash of DB, I'll run the script to create users, role, and grant privileges.  Then log in as an authorized user and run the sql scripts to create the tables, procedures, packages, and triggers; Finally, to recover the data via RMAN.

    Is this a good practice for backup/recovery, or there are ways to do better?

    Thank you.

    Scott

    scottjhn wrote:

    Oracle 11.2 and Developer SQL 3.2.

    For the backup of the data, I use OEM/Rman to schedule a backup.

    Additional OEM backup.

    The backup operation is made by rman.

    My understanding, these are usually data only (physical backup).

    RMAN backup of the physical database.  Technically, it makes copies of data blocks in the data files.  He does not know, nor she cares, that contains a given block.  And this data block "term" is wider than you can imagine.  Consider this: the entire database - tables, indexes, the data dictionary (which itself is nothing more than a collection of tables), stored the DDL, code compiled... everything fits in these data files and data files are all made up of blocks of 'data '.

    Now, I want to make the backup of the logic for the tables, packages/procedures and triggers.  I currently use Oracle SQL Developer to export as separate SQL files.

    I wonder if there are any other options to save the tables, procedures and triggers?

    That's what rman.  backup of tables, procedures, triggers,... everything.

    Currently I am guard three types of backups:

    (1) creation of user scripts, role and grant the user privileges.

    (2) tables, packages/procedures and triggers saved via Oracle SQL Developer

    (3) data ora saved through OEM

    Total crash of DB, I'll run the script to create users, role, and grant privileges.

    DB crash, you want to have a database to run these scripts.  You will FIRST need to restore/recovery database... backups rman.

    Then log in as an authorized user and run the sql scripts to create the tables, procedures, packages and triggers.

    ; You don't have to run all the scripts, because all the tables, procedures/packckages, and triggers will have already been restored by rman when he corrected/restored the database.

    Finally, retrieve the data via RMAN.

    And, precisely, what do you think this means at this point?

    Is this a good practice for backup/recovery, or there are ways to do better?

    There are much better ways.  Especially what you describe will not work.

    You have a serious misunderstanding on what rman is and does.  You need to spend some serious time, read the rman users guide, at https://docs.oracle.com/cd/E11882_01/backup.112/e10642/toc.htm

    And, FWIW, I would NOT recommend depending on the OEM manufacturer to plan backups or perform a recovery.

  • Difference between function and procedure

    Hi all

    My doubt is that the procedure can be used to return multiple values with OUT parameter and function can also be used to do the same if necessary to return multiple values with OUT parameter.

    So with this point of view, which is maybe the difference between these types of the two objects. and obviously if necessary to choose one of these two, we'll go to procedure, why not function?

    What is perhaps the reason for this?

    Thanks in advance.

    Kind regards
    Vipin Kumar Rai

    Nitesh. wrote:
    The main difference I between stored procedure and function of stored procedures compiled only once and can be called again and again without be compiled every time, this improves performance and saves time, of other functions to compile every time as is called...

    Would you care to show what you mean. To the best of my knowledge this last statement is not correct.

    The main difference for procedures and functions it program design.

    A procedure should be used for something that is running a process, where nothing is required to be returned.
    A function should be used when a value is required to be returned.

    Yes, the procedures can have OUT parameters (as can functions) but that is generally considered bad practice. If you have values be returned, you must use a function with an appropriate return type (structured type if necessary) so that all the requirements of data is returned via the return value. IMO the only acceptable practice to use variables is when you use a variable IN OUT for something in a procedure for this element which is manipulated by the procedure, so for example you'd 'ManipulateData (myData); as a procedure rather than "myData: = ManipulateData (myData);" in function, where the latter would be using resources of additional memory (copies of data) in most cases.

  • differences between the procedures and functions.

    a little confusing... differences between procedures and functions...

    1. a function returns only the unique value? can't return us multiple values?

    2. can we use clause of 'back' and 'out' parameter at the same time in the same function

    Thank you

    Hello

    Simply create a TYPE for strong cursors, returning the specified columns. For genereic, or the low sliders, there is a TYPE integrated, namely SYS_REFCURSOR.

    Try this:

    CREATE OR REPLACE function test_f(p_DEPTNO  in emp.DEPTNO%type)
      return SYS_REFCURSOR
      as
         REF_C     SYS_REFCURSOR;
    BEGIN
         OPEN  REF_C  FOR   SELECT  *
                             FROM    EMP
                      WHERE   DEPTNO = P_DEPTNO;
         RETURN REF_C;
    END;
    

    You don't want to close the cursor service.

    Always format your code.

Maybe you are looking for