Does all functions and procedures work this way ? (dbms_lock)

hi guys,
all along, i thought..
begin
dbms_output.put_line('a');
dbms_output.put_line('b');
end;
when ranned, i will thought of oracle pl/sql interpreter reading the source line by line
as the steps below
- saw dbms_output.put_line('a') ... print a
- saw dbms_output.put_line('b'); ... print b
thats all..
but after using dbms_lock, i realise its abit different from how i thought ..
begin
dbms_output.put_line('a');
dbms_lock.sleep(10);
dbms_output.put_line('b');
end;
i would have to actually wait for 10 sec before i can see the result 'a' and 'b'..
so it seems to me
the interpreter would
1) see dbms_output.put_line('a'); -- know it is going to print 'a' but doesnt do that yet
2) see dbms_lock.sleep(10); -- sleep for 10 sec..
3) see dmbS_output.put_line('b') -- knows it is going to print 'b' but doesnt do that yet
4) see end; -- ok print 'a' and 'b'
so somehow , for returning result or printing.. it seems to have done so until the END of the block/procedure/function INSTEAD of intepreting line by line and executing it.
However, for dbms_lock.sleep(10), its seems to be interpreted and executed immediately in the midst of the block.
so can i conclude that
for returning/displaying result, it is done at the end of the block
for others, it is done during the block
am i right ?
Best Regards,
Noob

Thinking is always a good thing, but reading docs is helpful too. PL/SQL unit always runs on database server side and always as a unit. dbms_output.put_line('A') simply writes A to a buffer and PL/SQL unit continues to execute. when whole unit completes buffer has all lines written to it. Now client tool SQL*Plus in your case can read buffer content and display it. SQL*PLus does it based on SET SERVEROUTPUT ON/OFF command. I hope now you understand that DBMS_OUTPUT does not provide an interface to to display output on client box but rather store it in a buffer.
SY.

Similar Messages

  • Getting all Functions and Procedures using DBA_ARGUMENTS

    Hi All
    I am wanting to find out all functions and procedures that are within each of my packages and am using the following SQL to do this.
    SELECT DISTINCT A.OBJECT_NAME, A.PACKAGE_NAME,
    DECODE(POSITION,0,'FUNCTION','PROCEDURE')
    FROM DBA_ARGUMENTS A
    WHERE OWNER = 'NB'
    I have discovered however that if a procedure has been overloaded with function will appear twice: as procedure and as a function
    I was wondering if there was any workaround for this as I would only like a function to be displayed once?
    Kind Regards
    Mark

    There is an 'OVERLOAD' column which can be used to show only specific overloads (e.g. first).
    Determining which overload should be displayed in any given case may require some more thought.

  • Query for getting all function and procedure inside the packages

    hi All
    Please provide me Query for getting all function and procedure inside the packages
    thanks

    As Todd said, you can use user_arguments data dictionary or you can join user_objects and user_procedures like below to get the name of the packaged function and procedure names.
    If you are looking for the packaged procedures and functions source then use user_source data dictionary
    select a.object_name,a.procedure_name from user_procedures a,
                  user_objects b
    where a.object_name is not null
    and a.procedure_name is not null
    and b.object_type='PACKAGE'        
    and a.object_name=b.object_name

  • Drop  all functions and procedures

    How can I delete all functions and procedures by using Native Dynamic SQL

    Loop against DBA_OBJECTS for the object_type and owner you want to delete.
    For each loop, build your query into a variable, then execute it.
    http://tahiti.oracle.com/pls/db102/drilldown?levelnum=2&toplevel=b14261&method=FULL&chapters=0&book=&wildcards=1&preference=&expand_all=&result_id=1662311&verb=&word=execute+immediate#b14261
    Nicolas.

  • Safari says "i cannot open the page because the server cannot be found" I get this on Safari and Mail does not function. Apps work like a dream. All Windows OS are screaming. Any thoughts?

    Safari says "i cannot open the page because the server cannot be found" I get this on Safari and Mail does not function. Apps work like a dream. All Windows OS are screaming. Any thoughts?

    You can check this thread for the answer you are looking for.
    https://discussions.apple.com/thread/3685247?start=0&tstart=0

  • Combobox in array--why does it work this way?

    I have attached a snippet of a subVI I'm using to initialize the items and set the values of comboboxes in an array. I modified it slightly so the array being referenced is on this block diagram, not a top level diagram. It took me a while to come to this solution; before I had the combobox part in a for loop and was trying to loop through each array element, get a reference to that element, and set the strings[] and value properties but it was acting all wacky. Then I changed it to the way below and it automatically populates all the comboboxes with the correct values, and then sets their values each to be different (which is what I want!) My question is, why does it work this way? I understand all elements in an array need to be the same (although I did find a work around here.), but the part about setting the values to each be different I was trying to do manually with a property node and a value property, when I realized the combobox just handles it all itself. Is this just a feature of a combobox in an array I need to note for future reference? 
    edit: I noticed the testers array reference label changed, so hopefully it's still referencing the same control. You may need to relink it.
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    combobox in array snippet.png ‏29 KB

    nathand wrote:
    Ben wrote:
    nathand wrote:
    You cannot get a reference to an individual element in an array control.  The ArrayElem reference will always refer to the same control regardless of what array index is visible.  This isn't specific to a combo-box, every array works like this.
    I have not tested it lately but as of the time of this Nugget I found that it will point to the top left visable array element.
    The ArrayElem property always returns the same reference no matter which element of the array is in the top-left corner, as demonstrated by the code below (screenshot instead of snippet to avoid mangled references and property nodes).
    Yes that is true but the value returned when using a property node >>> value will return the top left displayed value. In the code included in that Nugget, I set the size of the control such that it only shows a single element then by manipulating the index control I can raed each element in the array.
    At least that is how it behaved back in the day of that nugget.
    Yes, my wife left me home alone with a case of beer and LV to find that tidbit. I suspect that feature will one day disapear without anyone noticing.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • My keyboard failed to put accents spelling.  Through the system can not recognize the keyboard. This keyboard has one year and has always worked well and suddenly became this way, what to do

    My keyboard failed to put accents spelling.
    Through the system can not recognize the keyboard. This keyboard has one year and has always worked well and suddenly became this way, what to do

    Hi ,
    Do you remember if you  have installed some software prior to this issue?
    Delete programs you never use.
    If the issue reoccurs in Clean Boot, but works fine in Safe Mode, the cause may be the disabled hardware drivers. You may narrow down the
    causes in Device Clean Boot.
    Device Clean Boot
    =================
    1. Click Start, type "devmgmt.msc" (without quotation marks) in the Search bar and press Enter.
    2. Expand "Sound, video and game controllers".
    3. Right click on your sound card and then click "Properties.
    4. In the dropdown menu of Device Usage, please choose "Do not use this device (disable)" and click OK.
    5. Please use the same method to disable other dubious hardware such as: internal modem, network card and CD-R drive. Please note some devices
    such as video adapter are not available to be disabled.
    Tracy Cai
    TechNet Community Support

  • My sister bought a 16GB iPod touch 5 and went thru all the steps to set up but then realized it didn't have a camera. So we clicked reset and erase all contents and settings. This does mean her credit card info is erased right?? Thanks for your help.

    My sister bought a 16GB iPod touch 5 and went thru all the steps to set up but then realized it didn't have a camera. So we clicked reset and erase all contents and settings. This does mean her credit card info is erased right?? Thanks for your help.

    Welcome to Apple Support Communities
    When you erase an iPod touch, your information, apps and settings are deleted and iOS is back to factory settings. If she wanted an iPod touch with camera, she should return it after erasing it. Note that the iPod touch doesn't store her credit card information

  • I just purchased a chromebook, does CC Photoshop and lightroom work with this computer?

    Does photoshop cc and lightroom work with a chrombeook?

    No. Adobe software only works with Windows and Apple OS X operating systems.
    Chromebook runs the Chrome operating system.
    You get apps for the Chromebook from the Chrome Web Store Chrome Web Store apps
    Adobe is working on a streaming version of Photoshop for Chrome but it's still being tested.
    Adobe's got Photoshop running in Chrome | The Verge

  • Oracle Form functions and procedures in APEX, how?

    I am working to recreate in APEX, already existing Read Only Forms in Oracle Forms. APEX Interactive Report functionality among other things, makes it worth while as well as targetting a different audience than the one that utilizies the Oracle Form versions. Oracle Forms versions use lots of pre and post query triggers, PLSQL Functions.
    In Oracle Forms one of the places those functions can be located is in the "Program Units" section of the Form. A typical function of this sort, based on a specific Mission ID Itinerary, collects scheduled passengers last names, formats them with a comma and space after each one, into a single string that is returned and displayed as the passenger list of one row.
    I have all this code written so I can move most of the main query of the Oracle Form into an Interactive Report. These functions and triggers called from within the Form, from the "Program Units" section of the Oracle Form rather than being stored in the Database schema in a package, where would they go inside APEX? Can I create a "Shortcut" in APEX and call it from the Interactive Report "Region Source"? Can I create the PLSQL function at the page level or region level of the Interactive Report? Or, is my best bet creating a package stored in the database, of all these functions and/or proecedures I may need from the original Oracle Form?
    Some advice would be greatly appriciated.

    RLBickham wrote:
    I don't think I have been clear enough in describing the specific thing I want to do, it simply does not reach the level of forms to APEX conversion. It is basically a PLSQL Function problem.
    I have an Interactive Report that is currently getting 90 percent of what I want however, each row, representing a Mission may have multiple legs. Each Leg has two locations or ICAO codes attached to it. Based on the Mission number, I want to loop through the leg table, collect all the ICAO codes for that Mission, put them all into 1 variable separated by a coma and add that variable to the column display of that Interactive Report as the last column.
    In Oracle Forms I have a function saved to the database that is called within the main query. Maybe I am asking a question that does not need to be asked but in any case my question is can I put that function currently in the database somewhere in the confines of the Interactive Report and reference it via Http somehow or should I just stick with putting functions and procedures in packages stored in the database and called the conventional way?You could move the function to the database and call it from the report query, but it sounds as if it's superfluous. In the report query use whatever form of Re: 4. How do I convert rows to columns? is appropriate to your (unspecified) database version.
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.

  • How does Illustrator allign and distribute work

    Hi
    I am trying to understand what is happening behind the align and distribute functions in Illustrator.
    I am working on a PC with Illustrator CS5
    I have taken a photograph of a stone wall in to Photoshop:
    Converted it to grey scale
    Reduced it with levels to black and white
    Then selected the black and converted the selection to paths.
    Exported the path as an illustrator
    Imported it to Illustrator ( I know I could trace it in illustrator but I prefer t work this way round).
    All objects are un grouped and on one layer in Illustrator.
    Select all objects
    Open the Align pallet
    Set Align To Artboard
    Apply distribute Horizontal Center
    Apply Distribute Vertical Center
    The objects are distributed across the Artboard
    Select all objects
    Horizontal Align Center
    Vertical Align Center
    Apply distribute Horizontal Center
    Apply Distribute Vertical Center
    The arrangement is different
    Do the same exercise with 15 circles of the same size and a similar redistribution happens.
    What is determining or influencing the re ordering?
    it does not seem to be size or the layer order.

    Thanks to everyone who has replied to my question.
    Some interesting information and comments.
    I am still unsure as to what logic Illustrator is using. I can understand that layer or other orders might effect the order. I started thinking about creation order and if this is different to layer order. So I exported my dots test file as .svg so I could look at this. I then re imported it at the distribution was more predictable. If I align to bottom, left then distribute h and v I got a diagonal line of dots. This is what I would have expected to get. I still need to test this out more.
    before svg
    after svg conversion
    My main problem is that if I am going to use the distribute I need to know and understand what it is doing.

  • Double quotes in function and procedure names when using impdp

    When viewing a function in the original database, it looks like:
    CREATE OR REPLACE FUNCTION TA_ACTIVITY_D_GEN_FNC
    After doing an expdp and impdp to restore a development database, it now looks like
    CREATE OR REPLACE FUNCTION "TA_ACTIVITY_D_GEN_FNC"
    and also has 2 blank lines at end of function.
    This causes us problems when trying to use various utilites to compare differences in production and development. Now every function and procedure shows up as being different.
    Can someone please explain why and what can be done to avoid this from happening?
    Edited by: user6116705 on Jun 15, 2010 7:52 AM

    from old exp, here is the first line of the create procedure statement:
    CREATE FORMAT71 PROCEDURE "SECURE_DML"
    You can see the double quotes. I don't understand why you wouldn't see the same compare issue with old exp. I was wondering what you were using for compare since it would let me know where to look for anything that has changed from the original create to the create performed by data pump. I remember there being an issue in this area. I just don't remember if it was extra spacing, upcasing, or something else or multiple changes. You could contact Oracle support to see if there is a fix and if it is backported to your version.
    The only other way you can possibly fix this (and it would be a huge pain) would be to run impdp with a sqlfile and then edit the sqfile to remove the double quotes and to remove any extra spacing/extra lines. A patch from Oracle would certainly be easier if one was available.
    Dean

  • New to Apple TV - do they all crash and freeze like this?

    I have had mine for about 10 days. I have had it freeze (and do the diagnostics/restart) about 15 times.
    I am starting to get the hang of it. It seems to hate a bunch of my videos (encoded home movies mostly - used Handbrake and VisualHub's Apple TV setting). I can get it to crash 'on demand' on a few videos.
    What gives with the crashing? Can't it just choke on a video and refuse to play? Many times the crashing does not seem to be specific to a video though.
    I have tried the diagnostics - it reported that it was fine. I tried the system restore .. still having trouble. I am thinking if I restore it again I should stick to the first firmware (ie: not update). Might that help?
    Things are working better with the sync'ing now that I know that iTunes must be open - and I disabled the Windows 7 firewall rather than just poking the hole for the port Apple was requesting.
    Anyway - I am really disappointed. The iPhone remote is great, I love having my iTunes library in sync - but lack of 1080p and these crashes are driving my family crazy. I am probably gonna return it, but hoping for some ideas...

    do they all crash and freeze like this?
    No, they don't.
    Take a look at this document to see what formats are supported and how to properly convert them.
    http://support.apple.com/kb/HT1532
    This next document is very specific as to the formats that will play.
    http://support.apple.com/kb/SP19
    iTunes has the ability to convert movies to the proper format. So does Quicktime Pro. For the record, though, I have converted a number of videos using the Mac version of Handbrake and have had no issues what-so-ever playing those files.
    Message was edited by: lkrupp

  • How to use type, packages, functions, and procedures in another schema ?

    I have two target schema in one OWB project, such as A and B. In a mapping of A, I would like to use some types, packages, functions, and procedures from B. I have tried the method of synonym as suggested, but I could not find the metadata of these when importing ... The only type of synonym I can import is the synonym for table. Is there a bug for synonym?
    If I cannot use synonym for this issue, is there another way to solve the problem?

    Now, in some instances you will absolutely need to create the second module as Carsten describes, however it should also be noted that you can reference objects in things like Expressions even if you have not loaded up the metadata. It is only when you need strong binding that it becomes neccessary to import objects. For everything else, as long as the reference will resolve at compile-time then you are good to go.
    For example, I have a function in one target schema (S1) and a private synonym to it in another(s2). A mapping in the S2 schema has an expression object that uses the synonym to the function in the expression property for a couple of the output attirbutes. The synonym has not been loaded into metadata - indeed OWB has no knowledge of its existance. But it resolves at compile time so the mapping validates and generates successfully.
    Mike

  • Exact difference between function and procedure

    exact difference between function and procedure(real time diff.....not like return value, dml....) and function do some work at the same time that work also do procedure..why function

    ranitB wrote:
    1. Function is called Inline a query. A return value is must.
    But, procedure may/may not contain a return value.Not true.
    A function may be called in a query providing it meets certain limitations (no DDL, or transactional statements such as commit/rollback etc.).
    A function does not have to be called from a query, it can be called from other PL/SQL code or from other external applications.
    Regular functions must return a value, though pipelined functions do not...
    SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
      2      l_idx    PLS_INTEGER;
      3      l_list   VARCHAR2(32767) := p_list;
      4      l_value  VARCHAR2(32767);
      5    BEGIN
      6      LOOP
      7        l_idx := INSTR(l_list, p_delim);
      8        IF l_idx > 0 THEN
      9          PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
    10          l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
    11        ELSE
    12          PIPE ROW(l_list);
    13          EXIT;
    14        END IF;
    15      END LOOP;
    16      RETURN;
    17    END SPLIT;
    18  /
    Function created.
    SQL> SELECT column_value
      2  FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    COLUMN_VALUE
    FRED
    JIM
    BOB
    TED
    MARK... whilst the definition of the function shows a return type, the return statement inside the function simply returns, without a value. That's because the data is passed back through a special "pipeline", and you can write code to show that the data is available to a query as soon as it's piped, and before the function has completed (reached the return statement) if you like.
    A procedure does not return a value (And no an OUT parameter is not a "returned" value, it's a writeable parameter, there's a difference)
    2. There are some limitations in functions which is possbl through procedures.
    Like - Oracle doesn't support DML in functions called in Select queries (using PRAGMA AUTONOMOUS_TRANSACTION will help).Not strictly true. and SQL query is considered to be DML, so a function could perform a query and then be used inside another query...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function f_dname(p_deptno in number) return varchar2 is
      2    v_dname varchar2(10);
      3  begin
      4    select dname into v_dname
      5    from   dept
      6    where  deptno = p_deptno;
      7    return v_dname;
      8* end;
    SQL> /
    Function created.
    SQL> ed
    Wrote file afiedt.buf
      1* select empno, ename, f_dname(deptno) as dname from emp
    SQL> /
         EMPNO ENAME      DNAME
          7369 SMITH      RESEARCH
          7499 ALLEN      SALES
          7521 WARD       SALES
          7566 JONES      RESEARCH
          7654 MARTIN     SALES
          7698 BLAKE      SALES
          7782 CLARK      ACCOUNTING
          7788 SCOTT      RESEARCH
          7839 KING       ACCOUNTING
          7844 TURNER     SALES
          7876 ADAMS      RESEARCH
          7900 JAMES      SALES
          7902 FORD       RESEARCH
          7934 MILLER     ACCOUNTING
    14 rows selected.It's been discussed many times on the forum... my favourite here...
    {message:id=1668675}
    Edited by: BluShadow on 17-Sep-2012 09:22

Maybe you are looking for

  • Can I run Adobe Reader 7 or later with Acrobat 6 Pro?

    I currently have Acrobat Pro 6 installed, which works fine. But I am now getting a message appearing prior to opening some pdf's that the document may not display or format properly as they were made by a later version - these aren't the exact words

  • App store apps name

    Hello, I would like to report the difficulty and mess there is now in searching for apps or games in the app store. What people would do to earn money!! I'll try to better explain myself: less serious developers now use to name their app with aaa etc

  • Installing OS X 10.5

    I have a iMac G5 1.8 ghz that the optical drive does not work, so I have a firewire external hook up. I am trying to move this computer form 10.4 to 10.5. I have reformatted the hard drive for a clean install. I have install disks, but the installati

  • Can't Unbundle By Name slider

    Hey, I'm trying to use a slider control with two sliders. The Unbundle By Name does not seem to work correctly. Is this expected behavior, or has it already been fixed in 8.5? Error: "Some items in the cluster input to this Bundle/Unbundle By Name fu

  • Siri doesn't pick up uk local business and maps

    When asking siri to find a local pub or restaurant or maps it's says it can only find USA and under stand American voice when is the date when it will work in the uk, cause I don't want to get rid of my apple products got many apple devices and live