Are constants of body of the PL/SQL Package in the shared or private area

Based on that it is not clear to me if body Package PL/SQL constants are stored in the shared or private area.

http://docs.Oracle.com/CD/B28359_01/server.111/b28318/memory.htm

"PL/SQL program units and the Shared Pool

Oracle database treats PL/SQL program units (anonymous blocks, procedures, functions, packages and triggers in database) much the same way he treats the individual SQL statements. Oracle database allocates a shared area to hold the shape analyzed, compiled a program unit. Oracle database allocates a private space to hold values specific to the session who runs the program unit, including local, global and package variables (also known as the package is instantiated) and stamps of SQL execution. If more than one user is running the same program unit, a place unique and shared is used by all users, while each user runs a separate copy of his own private SQL area containing session-specific values.

The individual SQL statements contained in a PL/SQL program unit are processed as described in the previous sections. Despite their origins within a PL/SQL program unit, these SQL statements use a shared area to hold their analysed representations and a private space for each session, who executes the statement. »


I am also curious to know what are the differences in fine grain in a perspective of memory and performance (multisession) for the two examples below. One is more effective?


Example 1.

create or replace
package body
application_util
as

c_create_metadata constant varchar2 (6000): =...

procedure process_xxx
(
)
as
Start
...
end process_xxx;

end application_util;

vs.

Example 2.

create or replace
package body
application_util
as

procedure process_xxx
(
)
as

c_create_metadata constant varchar2 (6000): =...

Start
...
end process_xxx;

end application_util;

881398 wrote:

But I still have to ask because it seems still more particularly in example 1 that the constant can be attributed to the use that the actual value could be a pointer to a constant string value in a table of symbols or something related to the compilation unit. I'm always curious in a perspective of management of memory if there is a difference between the example 1 and example 2, and if one is better and why.

The storage is real, references to this storage internal to the PL/SQL engine. And irrelevant to the PL/SQL programmer.

This question is really a disagreement over the shape is better: example 1 or example 2. I prefer the 1 example, for readability, testability, etc., and so the question is where is the performance of the memory/differences and or is it just preference of developer.

I agree with rp0428 - he raised a very important point that it is a problem of scope and nothing else.

Basically is there any trade-off between using one shape on the other insofar as the performance and memory management?

Not really. Most runtime engines release not just actual system memory when a variable is out of range. the malloc() calls are expensive. Free() calls are expensive (and are not always the result in usable free memory which can be malloc'ed again).

Several execution engines use what is called a managed heap. A malloc is made of a new process when it is initialized. The heap memory / managed malloc'ed is adjacent. Pointer allocation of memory for this process is initially pointing to the base of the managed heap. As the process allocates / uses memory, the pointer is moved just advance in the managed heap, which indicates the HWM as such - the beginning of the 'free' memory in the heap. Allocation is sequential.

Reset of your variable execution, or releasing your runtime object, does not reset the HWM as other objects/variables can still be used and located after this place in the bunch. In this case set him free memory by releasing / resetting the language variables does not restore the kernel memory.

Memory management is a sophisticated process entirely processed by the engine running - and best left to the runtime engine. As you as a programmer do not explicitly control the memory management, it is not a good idea to try to write code that artificially attempt to use 'better' for the runtime engine memory management. The next version of the runtime of that aura of new features, optimizations and so on — and your interference in your code to get the "valorisation" of memory can happen just bite you not bad after an upgrade to execution.

Regarding the performance aspect - variable initialization is dependent on scope. In order to have a global scope means a one-time initialization, whereas a private scope (created each call) is a multiple unit. If the first is a little faster than the latter.

However, the performance differences are tiny - IMO too small to justify this as a valid consideration to spend in addition to the decision of functional design on what possibilities a variable or a constant need to have.

SQL> create or replace package FooLib1 as
  2          procedure Exec;
  3  end;
  4  /

Package created.

SQL>
SQL> create or replace package body FooLib1 as
  2          const1  constant varchar2(32767) := rpad('-',10000,'-');
  3
  4          procedure Exec is
  5                  var1    varchar2(32767);
  6          begin
  7                  var1 := const1;
  8          end;
  9  end;
 10  /

Package body created.

SQL>
SQL>
SQL> create or replace package FooLib2 as
  2          procedure Exec;
  3  end;
  4  /

Package created.

SQL>
SQL> create or replace package body FooLib2 as
  2          procedure Exec is
  3                  const1  constant varchar2(32767) := rpad('-',10000,'-');
  4                  var1    varchar2(32767);
  5          begin
  6                  var1 := const1;
  7          end;
  8  end;
  9  /

Package body created.

SQL>
SQL> set timing on
SQL> exec for i in 1..100000 loop FooLib1.Exec; end loop;

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.28
SQL> exec for i in 1..100000 loop FooLib2.Exec; end loop;

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.74
SQL> 

A second difference 0.0000046 in a single execution for FooLib.Exec between the use of package for the constant scope, against increased private. Which means that the issue of the scope is not a decision of the performance. Not when improving performance overhead is 0,0046 millisecs.

Tags: Database

Similar Questions

  • APEX shortcuts using the source of the body of the PL/SQL function

    Hi all

    Recently, I came across the feature of "Shortcuts" in the "Shared components" section of the APEX and thought great, somewhere to set the common/standard items once, then use these several times in different pages of my application.

    This seemed to work correctly when you use the 'Source' of "HTML Text" or "HTML text with special characters escaped", but then I wanted to explore the use of the "Body of the PL/SQL function" option to create a more dynamic shortcut/variable on the base.

    This is where I came across a particular problem in the APEX (Version 3.2.1.00.10 on GR 11, 2 on Oracle Enterprise Linux). When I set my shortcut, and then perform a reference to my shortcut (using "MY_SHORTCUT") in an area of a page, the value of shortcut is back, but is added with the reference variable (ie. the 'MY_SHORTCUT' chain).

    For simplicity, my example looks like this (of course, my real world example is a bit more complicated, but this example produces the same error):
    (a) I define my shortcut called "MY_SHORTCUT" and using the body of the PL/SQL function under "Source Type", define my procedure as "htp.p(:USER)."
    (b) I then create a new page (basic HTML page), and a new region of the 'type'-> 'HTML Text (with shortcuts).
    (c) in the "Source region", I define my shortcut like - "MY_SHORTCUT".
    (d) I apply changes and then run the page.

    I'll be back will be name of the current user with "MY_SHORTCUT" appended/added immediately after the user name - for example. the string:-' BRAD «MY_SHORTCUT»»

    Question is - how to stop the shortcut/reference text "MY_SHORTCUT" to be added to the variable you want to see the and thereafter on your page? I am just wanting the variable, NOT the reference for the shortcut.  I do something wrong using the HTP package, and if yes, what should I use?

    If "MY_SHORTCUT" is defined as "HTML text with special characters escaped" (where I can refer to elements of application using the syntax '& USER.') so that everything works correctly. My reason for using the PL/SQL is to generate a more dynamic output variable, based on elements of application throughout the entire application - and of course the use of shortcuts to minimize coding and duplication.


    Thanks in advance,
    Brad

    Hello

    The body of the PL/SQL function must RETURN a value.

    Try:

    RETURN :APP_USER;
    

    Andy

  • Filling point with the body of the pl/sql function

    Hello

    I want to fill an item "Show as text (saves the State)" in contrast to the other 2 points.

    The source of my question is:
    -Only when the current...
    -Body of PL/SQL function
    -Term source:
    DECLARE
    v_diff NUMBER;
    BEGIN
    v_diff: =: P1_AUFWAND_TOTAL -: P1_AUFWAND_BERECHNET;
    Return v_diff;
    END;

    Now I get this error:

    ORA-06502: PL/SQL: taking oder Wertefehler: Fehler beim zu if indication Zahl von
    Error ERR-1904 unable to calculate the default item: type = body of the function...

    I tried to find the problem with the conversion to_number:
    v_diff: = to_number(':P1_AUFWAND_BERECHNET'); or
    v_diff: = to_number (': P1_AUFWAND_BERECHNET', '999G999D00');

    What's not here? It's as if I'm making a simple mistake...

    Thanks for any help,
    Roger

    If the following code does not work for you, then one of the two elements are not the numbers:

    DECLARE
       v_diff   NUMBER;
    BEGIN
       v_diff := TO_NUMBER (:p1_aufwand_total)
                 - TO_NUMBER (:p1_aufwand_berechnet);
       RETURN v_diff;
    EXCEPTION
       WHEN OTHERS
       THEN
          RETURN SQLERRM;
    END;
    

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • After upgrade today all the body of the email are empty in all folders

    I've just updated Thunderbird today and as a result of the upgrade, I can't read all the emails. All messages from all folders have a body of the email blank.

    I can see the text in the messages as they arrive in the popup of the taskbar and also if I send a message.

    Can anyone help?

    Mark

    Said Smokva

    Well, my experience is that Outlook comes with its share of quirks, but I get completely where you come from and why you would want to.

    I'm glad you do. I'm sick of hearing people who give nothing, which suggests that they will do better when they give Microsoft $150 for Outlook. They get all the quirks of perspective and a Bill.

    I personally think is it's the people who think that they will get the best service if they threaten to go to the competitor who really said that. Just as we regularly get people fighting all the way to the support Forum to ask for a phone number where they can talk to a real person of their personal question. I don't know where they think the money to pay the salary of this fictitious person comes. Everything I am is from his pocket and abused.
    Perhaps they do not realize that in a commercial sense competitive Thunderbird is simply not there at all.

    For the original, poster of this picture, it seems that you are using the add-on for Thunderbird Conversations. Maybe if you have disabled it Thunderbird would work properly like this add-on has a problem with the current version. You can find all you need to do is to restart Thunderbird for the update can fill.

    Looking at the site of the add-on I see this

        • Version compatibility *.

    Thunderbird 38: Please make sure that you are running the most recent version (2.9.1) of the addon and restart Thunderbird - Thunderbird will allow you to spend 38 without updating the Conversations, giving you a broken configuration
    31 of Thunderbird: go to 'Versions' down to install 2.8.X

  • Email - incoming - Web pages and email in the body of the email addresses are invisable, unless I highlight?

    When I saw an email that contains a link to a web page or email link is not visible unless I highlight. Maybe it's the white text?
    Photos from our Sunday family photo session... It's the whole roll, I think. The value would be your opinion on those that you think are best.

    (https://www.dropbox.com/sh/m08cdln9pjljcqe/AADIKCe8wtr-JOe35W6uwQ2ba?dl=0) it does not show upward into the body of the email, only when I copied it.

    It does indeed look like your color options need to be changed.
    (In v38.1) Go to TOOLS - OPTIONS - DISPLAY - tab formatting and on the right side, you will see a small button for "colors". By pressing open a textbox and you show your presets active/visited link existing.
    Modify them to fit your theme and see if it works.

  • PL/SQL expreesion and body of the PL/SQL function

    Hi all

    Value of source of items, we have options like static text, DB columns like this.
    But I did not use PL/SQL and PL/SQL function body expressions when I try to use its not to validate.
    I know what format I can use?
    Complete program of PL/SQL or the body of the function.
    If possible provide two programs simple expression PL/SQL and PL/SQL function body

    Hello

    Or use ELSIF rather than ELSE IF

    Andy

  • How to get the query of the region "PL/SQL function body returns the query string"?

    Hello

    is it possible to get the query string from the region of type "PL/SQL function body returns the query string"?

    I can get the definition of the region as a PL/SQL procedure, but I am interested in the returned query. I tried to write something like

    < pre > v_return_query: = «...» » ;
    : P49_QUERY: = v_return_query;
    Return v_return_query; < / pre >

    to save the return on hidden item P49_QUERY string, but it does not work. I get the error message: ERR-1002 cannot find the item for the "P49_QUERY" element ID in the application '4000 '.

    Kind regards
    Przemek

    If you need to make reference to a page element in the block then you can use this type of control to avoid having to use generic column names:

    if apex_application.get_current_flow_sgid(:APP_ID) = apex_application.get_sgid then-- runtime  :P9_SQL := vSQL;else-- design time  null;end if;
    

    But if all you want to do is capture the SQL debugging you can take all the references element in the block and use the insert statement (in a debug table) as I showed earlier.

    Scott

  • Article to the page based on the body of the function

    Hello

    Apex 4.1.1 11 GR 2 linux oc4j

    I have two elements on the page that should be in function.

    I tried to do this in two ways.

    1. process across the page on load the prior header.


    de Debugging


    0.065940.20116... Run the statement: start if CHECK_FLAG_FACILTY( ) EVENS = > :P216_DETAIL) then : :P216_FACILITY_CHK = 'Y '; (- dbms_output. put_line () P216_FACILITY_CHK); -dbms_output. put_line 'TRUE'()); ANOTHER :P216_FACILITY_CHK := 'n'; (- dbms_output. put_line () P216_FACILITY_CHK); end if; If CHECK_FLAG_F_officer (EVENS = > :P216_DETAIL) then ::P216_OFFICER_CHECK = 'Y '; (- dbms_output. put_line () P216_officer_check); -dbms_output. put_line 'TRUE'()); ANOTHER :P216_OFFICER_CHECK:= 'n'; (- dbms_output. put_line () P216_officer_check); end if; END; end;4

    53

    http://10.22.8.30:8888/apex/f? p = 4000:939:347925946711601:NO:939:P939_PAGE_VIEW_ID:1117881 http://10.22.8.30:8888/apex/f? p = 4000:939:347925946711601:NO:939:P939_PAGE_VIEW_ID:11178810.267190.00145... Session state: saved point new 'P216_FACILITY_CHK' value = 'Y '.4

    0

    http://10.22.8.30:8888/apex/f? p = 4000:939:347925946711601:NO:939:P939_PAGE_VIEW_ID:1117881 http://10.22.8.30:8888/apex/f? p = 4000:939:347925946711601:NO:939:P939_PAGE_VIEW_ID:11178810.268570,00063... Session state: saved point new value "P216_OFFICER_CHECK" = "N".

    Values are met in session, but they are not displayed on the page.

    2.), I have two elements on the page in the source element

    call this function

    Begin

    : P216_FACILITY_CHK := null;

    if CHECK_FLAG_FACILTY( ) EVENS = > :P216_DETAIL) then

    : P216_FACILITY_CHK := 'Y ';

    (- dbms_output. put_line () P216_FACILITY_CHK);

    -dbms_output. put_line 'TRUE'());

    ON THE OTHER

    : P216_FACILITY_CHK := 'n';

    (- dbms_output. put_line () P216_FACILITY_CHK);

    end if;

    END;

    Source

    Top

    current value
    source

    But still it would be empty all the time.

    I guess for this feature...

    For your APEX point, you have the SOURCE = "PL/SQL function.

    The SQL code in the "Source" for this element should have a "return" statement

    The SQL you provided (I suppose has the same value as 'Source') did not have a "return" statement

    interesting note: when I didn't have a 'return' for items with "function from PL/SQL ', I got a weird error.

    so, I wonder if Miss me just a few information...

  • Cannot insert file body in the varbinary field!

    I have a variable with content received by cffile readbinary operation after the cfpop navigation file.
    I want to insert the body of the file in the database (don't tell me it's bad - there are a lot of 'con' and 'pro' for this solution).

    Thus,.
    < cfqueryparam value = "" #file_body # "cfsqltype ="cf_sql_varbinary">"
    works if my MS SQL Server field type is "image" and it gives
    "String or binary data would be truncated" error, when the type of the field is "varbinary".

    I would use the 'image' field type, but MS SQL said that it is deprecated and will be removed in future versions. And proposes to use "varbinary" instead.

    How to solve this problem? I tried cf_sql_longvarbinary, to indicate the value of maxsize - error is the same allthetime.
    In MS SQL varbinary length is 24, so it could keep about 16 MB

    Quote:
    Posted by: Nafiganado
    I would use the 'image' field type, but MS SQL said that it is deprecated and will be removed in future versions. And proposes to use "varbinary" instead.

    This applies only to the MS SQL 2005.
    Since you are using MS SQL 2000, you must use an image column.

    (Kind of games in 'against' you mentioned above, isn't?)

  • Can Thunderbird offer the possibility of images slect, via the thumbnail option, the selection of the images into the body of the email?

      • Thunderbird v.38.4.0 *.

    Not sure if the title makes sense, but I'm trying to find out if there is an option for Thunderbird display images as thumbnails, when you search for an image to be inserted into the body of an email? In other words, is possible that I can see what the images are, through Browse, before I "insert" in the body of the email. IE: thumbnails?

    Usually, it would be somewhere in the display options, where you can choose the size of icons, but the look on things, I don't think there are a thumbnails option, but I wanted to confirm this.

    If this isn't the case, it is a great option for future generations. It just makes so much more easier if embed you images, rather than tie them.

    Kind regards
    b1rd

    It shows the photos here for large or medium-sized icons, win 10. Open File Explorer and look at the display settings under Options files (see photo).

  • How do I change the email body is displayed to the right of the email list (which I prefer) of the body of the email is displayed under e-mail list?

    I installed the latest version of Thunderbird on my two laptops. The first installation on my new laptop (Windows 10) the default is that the body of the email was posted in the right column. I prefer this view. My second installation was on my old laptop (Windows 7) and that the default display has the body of the email below the list of emails. I've searched for nearly two hours in the help section and cannot find how to change that display in the body of the email in the right column with the e-mail list that is left with him. Sometimes it comes to options that are not available. I don't know why the same download would display different default settings. I know it must be something simple, but I'm frustrated trying to find. Can someone help me with this? Thank you.

    View (Alt - V) - Layout - display Vertical

  • When you click on a tab open, how to do the update automatically in the body of the page?

    When you click on a tab open, how to do the update automatically in the body of the page?

    Right clicking on a tab open and using the arrow keys now now moves through open tabs. I liked the old versions where just after having clicked on a tab you can directly go to the page with the arrow keys to navigate.
    Y at - it something that I can change the subject: config to change this behavior?
    Thanks in advance.

    Firefox has yet to set the focus in the area of browser if you click on a tab.

    Only with very old browser versions you could set the focus to a tab by clicking a tab.

    This problem is probably caused by an extension.

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance).

    • Do NOT click on the reset button on the start safe mode window or make changes.
  • I want a newsletter to read directly in the body of the e-mail message

    I did a 4 page layout newsletter on my Macbook Pro, OS X Yosemite. I don't want to be seen as an attachment when someone opens it. I want to read in the body of the email. Anyone know how?

    There is no simple answer to this unique.

    "To begin to realize that e-mails have no notion of the 'pages'... they are just continuous flow of content, so it is unlikely that you can duplicate your ' 4 page newsletter" in an e-mail message. The best you can do is to approach, but it will become really confusing if you have items that cross the spread or are kept on separate pages.

    Second to that, 'style' (i.e. non-text gross) emails use HTML to format, you must convert your document Pages in HTML format. There is no one-click this option. The best you're likely to get is to copy all Pages content and paste it into a new e-mail message (more a few cleaning). Have you tried? how it worked?

    The advantage of this approach is that non e-mail clients will always see a text version of the email.

    The other option is to 'print' each page as a separate image (for example JPEG) and insert 4 JPEG images in the e-mail message. This will ensure your shape/layout layout, even if it is somewhat difficult for users to navigate... and text browsers will not see any content.

    At the end of the day, you're still at the mercy of the messaging client of the recipient, each of which can have different options for the display of rich content.

    So, still today, fill the physical (printed/hard copy) and the digital worlds / email is still a bit of black magic.

  • Body of the email missing after the upgrade of the Mavericks in El Capitan

    I upgraded from the Mavericks to El Capitan today and although my Inbox lists my emails in a column on the left, the body of the message is missing. I have double-clicked on the messages and still get nothing. In addition, all of my sent mail disappeared and there is that nothing that is listed. I checked the pane accounts and my account is activated and all others are disabled. Any help would be appreciated.

    Try the following:

    1. Abandonment of post
    2. Move ~/Library/Containers/com.apple.mail to the desktop.
    3. Restart the messaging
    4. If Mail is not working properly, remove the com.apple.mail you had previously moved on the desktop.
  • entry screen iPhone 5 away from the body of the phone

    Hi all

    I was wondering if anyone has had a similar problem - the screen of my iPhone 5 has started to "detach" from the main body of the phone, and I have just been quoted £206,44 to repair.

    The screen still works, but at the bottom of the phone around the home button, it raised about 0.5 cm. I can push the screen but then it will be flex and bulge in the Middle the phone and when I let go of the center of the fall of the rear screen and the bottom rises again. I can lift the screen very slightly until the screen goes black.

    Phones do not are damaged/deleted and there has been a case on since purchase.

    I had looked around this and other forums and it seems to be due to a "battery swelling' users seem to be getting free out of warranty repairs or replacements. I expect to pay a little (postage, possibly a cost of repairs due to the age of phones), but £200 + is that the phone is worth the trouble. It is a model for the launch, so I got it since 2012.

    If anyone else has had this problem, and have you solved it without having to spend a huge sum of money?

    The most economical solution is to locate a category renowned repair shop.

    Be forewarned that the fan - boys on the forum will tell you that you're a bad person if you do.

Maybe you are looking for

  • Disappears from the vertical when scroll bar change the zoom level

    This happens on my site (http://www.gotravelshack.com/)and that in FireFox (not other browsers). Must refresh the page to get back scroll bar. Help, please. Thank you.

  • 4540 proBook s: drive hard long DST test failed

    Product name: ProBook s 4540 Operating system: Windows 7 Enterprise Problem: after Windows starts, I get a blue screen. Blue screen error: 0X0000007E Test: test result wide hard drive: SMART Check passed, Long DST failed Failure ID: 90FDX9 - Q 66, 80

  • Remove image from the desktop

    I have a picture on my screen, I downloaded as my display pic for my icons. (wallpaper) I tried everything I know to try to remove it! The only thing I could do was just his size to cover not my whole screen. How can I remove this pic/file? 2000 299W

  • movie maker is being in 64% of su codificación y no me graba el disco

    Hola mira tengo a proyecto hecho en movie maker pelicula para there grabarlo manda me a dvd maker, pero cuando doy al cuadro grabar begins codificación del disco y is being in 64% no one self that eso debe are no antes hacias lo mismo y no habia any

  • focus order

    How can I specify the order of the elements focus?