A question about the impact of SQL*PLUS SERVEROUTPUT option on v$sql

Hello everybody,
SQL> SELECT * FROM v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0  Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL>
OS : Fedora Core 17 (X86_64) Kernel 3.6.6-1.fc17.x86_64I would like to ask a question about the SQL*Plus SET SERVEROUTPUT ON/OFF option and its impact on queries on views such as v$sql and v$session. Here is the problem
Actually I define three variables in SQL*Plus in order to store sid, serial# and prev_sql_id columns from v$session in order to be able to use them later, several times in different other queries, while I'm still working in the current session.
So, here is how I proceed
SET SERVEROUTPUT ON;  -- I often activate this option as the first line of almost all of my SQL-PL/SQL script files
SET SQLBLANKLINES ON;
VARIABLE mysid NUMBER
VARIABLE myserial# NUMBER;
VARIABLE saved_sql_id VARCHAR2(13);
-- So first I store sid and serial# for the current session
BEGIN
    SELECT sid, serial# INTO :mysid, :myserial#
    FROM v$session
    WHERE audsid = SYS_CONTEXT('UserEnv', 'SessionId');
END;
PL/SQL procedure successfully completed.
-- Just check to see the result
SQL> SELECT :mysid, :myserial# FROM DUAL;
    :MYSID :MYSERIAL#
       129   1067
SQL> Now, let's say that I want to run the following query as the last SQL statement run within my current session
SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;According to Oracle® Database Reference 11g Release 2 (11.2) description for v$session
http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm#REFRN30223]
the column prev_sql_id includes the sql_id of the last sql statement executed for the given sid and serial# which in the case of my example, it will be the above mentioned SELECT query on the employees table. As a result, right after the SELECT statement on the employees table I run the following
BEGIN
    SELECT prev_sql_id INTO :saved_sql_id
    FROM v$session
    WHERE sid = :mysid AND serial# = :myserial#;
END;
PL/SQL procedure successfully completed.
SQL> SELECT :saved_sql_id FROM DUAL;
:SAVED_SQL_ID
9babjv8yq8ru3
SQL> Having the value of sql_id, I'm supposed to find all information about cursor(s) for my SELECT statement and also its sql_text value in v$sql. Yet here is what I get when I query v$sql upon the stored sql_id
SELECT child_number, sql_id, sql_text
FROM v$sql
WHERE sql_id = :saved_sql_id;
CHILD_NUMBER   SQL_ID          SQL_TEXT
0              9babjv8yq8ru3    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;Therefore instead of
SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;for the value of sql_text I get the following value
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES);Which is not of course what I was expecting to find in v$sql for the given sql_id.
After a bit googling I found the following thread on the OTN forum where it had been suggested (well I think maybe not exactly for the same problem) to turn off SERVEROUTPUT.
Problem with dbms_xplan.display_cursor
This was precisely what I did
SET SERVEROUTPUT OFFafter that I repeated the whole procedure and this time everything worked pretty well as expected. I checked SQL*Plus documentation for SERVEROUTPUT
and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
Could anyone kindly make some clarification?
thanks in advance,
Regards,
Dariyoosh

>
and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
Hi Dariyoosh,
SET SERVEROUTPUT ON has the effect of executing dbms_output.get_lines after each and every statement. Not only related to system view.
Here below what Tom Kyte is explaining in this page:
Now, sqlplus sees this functionality and says "hey, would not it be nice for me to dump this buffer to screen for the user?". So, they added the SQLPlus command "set serveroutput on" which does two things
1) it tells SQLPLUS you would like it <b>to execute dbms_output.get_lines after each and every statement</b>. You would like it to do this network rounding after each call. You would like this extra overhead to take place (think of an install script with hundreds/thousands of statements to be executed -- perhaps, just perhaps you don't want this extra call after every call)
2) SQLPLUS automatically calls the dbms_output API "enable" to turn on the buffering that happens in the package.Regards.
Al

Similar Messages

  • Shopping for a T61 - questions about the OS and various h/w options

    Hi,
    I am considering buying a Thinkpad T61, but it's been a while since I have bought a computer, let alone a laptop, so I thought I'd ask a few questions here.
    I have worked on several Thinkpads T-series at work before, and I liked them, but they were all provided to me by my employers.
    I am browsing the different models on the Lenovo Canada web site; the US site looks just the same.
    The use I would make of the computer is typical office work (Word, Excel, e-mail), synchronize data with a PDA, Internet browsing, some limited web (PHP) and image editing (Paint shop pro), and listening to digital music. On occasion, watch a movie on DVD.
    I don't play 3D games.
    I would use the computer with a docking station and an external keyboard, LCD monitor and mouse when I am at home.
    I am looking at the T61 models with 15-inch widescreen, integrated graphics and no mobile broadband.
    1.) Operating system: obviously, Vista is recommended by Lenovo, but I have heard so many negative comments on this OS that I wonder if I shouldn't stick to XP. Even on this forum, I see posts about problems with Vista. Any advice on that?
    2.) I already have a license for XP on my previous machine. Assuming I buy the Vista with this one, then I would legally have the right to install either system on it, right?
    I know the machine doesn't come with an install CD, but if I get one somewhere else, would I be able to install it, or does the OS come with some weird DRM system that will prevent me from installing another OS than the exact copy of the one that was shipped with it?
    I ask this because I'm fairly certain that I will want to change the way the system partitions are set up.
    (this might sound like a silly question, but the acronym DRM became so prominent in recent years that I want to make sure)
    3.) The website says that some T61 machines come with an integrated camera. Later on in the detailed descriptions, I don't see it mentioned anywhere. Which do and which don't come with the embedded web cam?
    4.) 15.4 WXGA TFT vs. 15.4 WSXGA+ TFT : what are the resolutions of each?
    5.) Hard drive: I would go with a 7200 rpm model. Is there any benefit to getting the 1GB drive cache?
    6.) DVD recordable option: how fast does it record CDs and DVDs ?
    Thank you in advance.
    Chris.-

    Hi Kevin
    about the speakers I cannot advice.
    Regarding the driver - if there is a driver update availabel from TOSHIBA (important!!) then use it! That means they have found some kind of bug in the original driver and released a fix for it. I do not recommend you to use the nVidia generic driver since it might make the PC behave bad. StandBy / Hibernation might stop working properly. Power consumption might go up....and so on.
    Regarding the BIOS. The BIOS'es are a special chapter - when upgrading the BIOS the machine re-writes a very special part of the 'hardware' (actually it's a software installed in a chip that does not go away when you turn the computer off, it is sometimes also called firmware). That firmware is needed (among other things) to get the machine to start and load the operating system.
    If the re-write process fails it could mean that the firmware is not able to start the machine anymore. And if the machine does not start at all, you will have no chance to retry writing the firmware. So that mean the machine will be dead and you will not be able to do anything about it except turning to an ASP and possibly pay for the service.
    So, that said, it is very important that you have a realiable powersupply (which you normally have with the AC Adapter) and that you make 100% sure that you use the correct BIOS-file.
    If you can accomplish those 2 small things there should be no problem upgrading the BIOS.
    BR
    Tom

  • Question about The SQL*Plus menu item

    The help doc says we can use SQL*Plus commands. So I open it from the SQL*Plus menu item under Tools. After I gave the installed SQL*Plus location and file name, SQL*Plus was opened by itself asking for a password. The question is are all SQL*Plus commands are supported/will be supported in Raptor? Thanks.
    ben

    See this.. http://www.oracle.com/technology/products/database/project_raptor/sql_worksheet_commands.html
    Not everything in plus is supported
    -kris

  • A question about the SPOOL command in sqlplus

    Dear all,
    I have a question about the SPOOL Command and I would appreciate if you could kindly give me a hand. Consider the following sql script.
    SPOOL result.txt
    SELECT * FROM mytable;
    SPOOL OFF;This works pretty well, and the whole content of the table "mytable" is exported to the text file "result.txt". However, sqlplus prints also the number of lines
    printed after each query. As a result, after running this script, at the end of the file, I have always a line like
    "20541 lines returned"How can I avoid this line (the number of returned lines) in my result file?
    Thanks in advance,
    Dariyoosh

    Peter Gjelstrup wrote:
    Hi Dariyoosh,
    As you are about to find out, SQL*Plus is a really powerful tool once the wonders of it are discovered.
    You really should study the reference
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/toc.htm
    In your current case especially the SET command
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/ch_twelve040.htm#BACGAJIC
    Regards
    PeterHello there,
    Thank you very much for your attention to my problem and in particular the interesting links.
    Kind Regards,
    Dariyoosh

  • Question about the DB adapter

    Question about the DB adapter
    ns2006.0.7
    Question:
    It seems that we can only have 1 db adapter, but in the adapter defiition we have to specify the database.  If I want to communicate to several different databases on different platforms, Oracle / SQL I need to install a DB adapter for each database connection. 
    I can't figure out how to add a second DB adapter, does anyone know how?
    Thank you
    Daniel
    Safeway Inc.

    Hi
    We're new at developing our own agents etc. We've leveraged the supplied DB agent and written the relevant adapter, however we're struggling with the transformation.
    Could I be cheeky and ask if anyone would be willing to share a transformation they have written for the DB adapter? Unfortunately no-one in our team has had past XML experience, so we're trying to backwards engineer from examples.
    Thanks, Meghan

  • Short question about the nano controls

    Hi. I'm probably going to buy a 4Gb nano today, but first I'd like to ask a short question about the << >> buttons on the click wheel.
    I read in a forum that the << & >> buttons are actually 'skip' buttons (only used to play the previous or next song respectively), and that it's impossible to rewind or fast-forward within the track you're listening to. This is extremely important for me as I have several 2-3 hours mp3, and I need to be able to access different parts of the file quickly (eg. not having to actually wait 1 hour to listen to my favorite part). I found this to be an important feature, and I can't believe Apple hasn't thought about it.
    Anyway, I've never used an iPod, that's why this question may sound plain stupid.
    Thanks for you replies!

    The iPod fast charges to about 80% and then trickle charges the rest of the way to prevent damaging the battery/iPod. A full charge takes more than an hour or two though the battery indicator will show full. The best way to tell if a full charge has occurred is to unmount the iPod from the computer but keep it connected. The screen will show an animation of a battery. When the animation stops the battery is fully charged.
    Also, as your battery discharges the indicator will eventually show red indicating the battery is about to run out...in an hour or two. After you've owned your iPod for a couple months you'll figure out how much time you have left when the indicator turns red - it depends on a number of factors including play volume, equalizer use, etc. In real world use I'm getting over 11 hours.
    The headphones are...average. If they didn't hurt my ears I'd find them acceptable for my pop music but not so acceptable for acoustic and symphonic nor music with booming bass - because they don't boom the bass.
    I encode the majority of my music at 256 AAC and I've noticed no distortion caused by the EQ. This, plus your complaint about the earphones, leads me to think perhaps you got a bum set of phones. Borrow a pair from someone else and see what happens.

  • SUP - 2 questions about the CDB (cache database)

    Hi,
    I have 2 questions about the cache database and the cache groups:
    1 - How does the "On demand" cache group policy exactly works? I know that online cache group is without storing any data on the CDB making direct requests to de backend from the device, the DCN is based on updating from the backend, the scheduled is based on a time period, but I don't understand how the "on demand" exactly works, and why it has a time period too.
    2 - Is it possible to query the cache database table to check the data that SUP has stored? How can I do this?
    Thank you!

    I posted a similar question in SUP Apps project not too long ago and  Paul Horan provided this useful reply:
    Create a "Sybase ASA v12.x for Unwired Server" connection profile in the Enterprise Explorer.  I named mine CDB.
    : Host = localhost (or whatever the machine name is)
    : Port = 5200
    : Database name = "default"
    : User Name = "dba"
    : Password = "sql"
    Obviously, change the userid/password to match, if you changed them during install time.
    Connect, and you'll see the "default" database displayed.
    Navigate down through the Tables folder, and the first subfolder is labeled something like [#should_delete_sk ...]  Start there.
    You'll see a bunch of tables with the naming convention "D1" + package name + package version + MBO name.  These are the cache tables for the MBOs.

  • 4 questions about the the top boxes - SD box and Home media DVR

    Hello. I am going to be getting Fios soon and I have some questions about the boxes. I will be getting the Home Media DVR and 4 SD boxes.
    1) Do these boxes have timers on them to set so the box can turn off at a certain time?
    2) Do these boxes have parental control and if so is it good enough to block things that I do not want my child to see?
    3) How many people can access the home media dvr at the same time to watch already recorded programs
    4) If the Home Media DVR is in the family room can a record be started from the bedroom over the SD set top box (even an hd show)?
    Thanks for any help.

    I have been using two Standard Set Top Boxes for about a year. I have Parental Controls on and all channels locked. When I want to watch a channel, I tune to that channel, note the LOCKED message, which tells me to press the OK button to enter ther Parental Controls PIN and unlock the channel for viewing.
    This has worked flawlessliy for the last year -- ON THE Standard STB's.
    I just ordered the Home Media DVR STB to replace one of my Standardt STB..
    On the Home Media DVR:
    I can set the Parentals Control PIN and lock the channels, in the exact same way I did o nthe Standard STB's. However, when  tuen to ANY channel, I still ge the LOCKED message and instructions to press OK to unlock the channel -- BUT no matter how I press the OK button, the Enter your Parental Conlrols PIN dialog box willl NOT open. Nothing happens -- you CAN NOT view any channel.
    Again, it is the EXACT setup as for the Standard STB, but the OK button will NOT unlock any of the channels.
    If you unlock all channels and LOCK the Ratings, the same problem recurs: OK buitton will never open the "enter your PIN" dialog box.
    I have received two replacement boxes and have spent hours on the phone with some very capable and helpful Techs -- no luck.
    Has anyone else had the same problem? Here's how to test your Home Media DVR:
    1. Menu-Settings-Parental Controls.
    2. You will be prompted to CREATE youre Parental Controls PIN
    3. Enter you PIN twice.
    4. Use the > button to scroll to Enable On/Off and set it on.
    5. scroll down to Control Channels
    6. Press > button to See Locked Channels
    7. Scroll down to Add/Remove Channels
    8. Scroll right to choose LOCK ALL
    9. Press OK and then scroll to YES to lock all channels
    10. Press EXIT to get out of settings.
    11. All channels are now locked.
    12. Go to any channel
    13. A black screen will appear with a lock silhouette with the word LOCKED below, followed by instructions to Press OK to enter PIN and unlock this channel. (plus how to change locks...).
    14.Press the OK button and, if it is working, you will see a dialog box at the bottom of the screen that is titled: UNLOCK, with the channel listed and the instructions to "Enter your PIN using your numeric pad on remote to naje this channel availabe for all users." THere's a PIN box, which shows asterisks for each number entered, with "Press Exit to Cancel" below.
    15. On the Standard STB, it works exactly as described in steps 1 thru 14. On the Media Center DVR, it works up to step `13, but in 14, no matter how you press the OK button, the UNLOCK dialog box never pops us. The Remote STB light flashes on the remove and the REMOTE yellow light flashes on the DVR,  but nothng happens.
    If you have a Home Media DVR, can you please try this and see if it works?
    Thanks,
    John

  • Re: Question about the Satellite P300-18Z

    Hello everyone,
    I have a couple of questions about the Satellite P300-18Z.
    What "video out" does this laptop have? (DVI, s-video or d-sub)
    Can I link the laptop up to a LCD-TV and watch movies on a resolution of 1080p? (full-HD)
    What is the warranty on this laptop?

    Hello
    According the notebook specification Satellite P300-18Z has follow interfaces:
    DVI - No DVI port available
    HDMI - HDMI-out (HDMI out port available)
    Headphone Jack - External Headphone Jack (Stereo) available
    .link - iLink (Firewire) port available
    Line in Jack - No Line in Jack port available
    Line out Jack - No Line Out Jack available
    Microphone Jack - External Micrphone Jack
    TV-out - port available (S-Video port)
    VGA - VGA (External monitor port RGB port)
    Also you can connect it to your LCD TV using HDMI cable.
    Warranty is country specific and clarifies this with your local dealer but I know that all Toshiba products have 1 year standard warranty and also 1 year international warranty. you can of course expand it.

  • Questions about the Apple Developer Enterprise Program

    Hi there,
    i got some questions about the Apple Developer Enterprise Program:
    - is there a way a company can create their own "AppStore" with only the APPs the employees should use?
    - when I developed the enterprise app are the install files on a apple hosted server or do i need my own infrastructure to distribute my app?
    Thanks in advance for answers!

    Google: MDM

  • Some questions about the integration between BIEE and EBS

    Hi, dear,
    I'm a new bie of BIEE. In these days, have a look about BIEE architecture and the BIEE components. In the next project, there are some work about BIEE development based on EBS application. I have some questions about the integration :
    1) generally, is the BIEE database and application server decentralized with EBS database and application? Both BIEE 10g and 11g version can be integrated with EBS R12?
    2) In BIEE administrator tool, the first step is to create physical tables. if the source appliation is EBS, is it still needed to create the physical tables?
    3) if the physical tables creation is needed, how to complete the data transfer from the EBS source tables to BIEE physical tables? which ETL tool is prefer for most developers? warehouse builder or Oracle Data Integration?
    4) During data transfer phase, if there are many many large volume data needs to transfer, how to keep the completeness? for example, it needs to transfer 1 million rows from source database to BIEE physical tables, when 50%is completed, the users try to open the BIEE report, can they see the new 50% data on the reports? is there some transaction control in ETL phase?
    could anyone give some guide for me? I'm very appreciated if you can also give any other information.
    Thanks in advance.

    1) generally, is the BIEE database and application server decentralized with EBS database and application? Both BIEE 10g and 11g version can be integrated with EBS R12?You, shud consider OBI Application here which uses OBIEE as a reporting tool with different pre-built modules. Both 10g & 11g comes with different versions of BI apps which supports sources like Siebel CRM, EBS, Peoplesoft, JD Edwards etc..
    2) In BIEE administrator tool, the first step is to create physical tables. if the source appliation is EBS, is it still needed to create the physical tables?Its independent of any soure. This is OBIEE modeling to create RPD with all the layers. If you build it from scratch then you will require to create all the layers else if BI Apps is used then you will get pre-built RPD along with other pre-built components.
    3) if the physical tables creation is needed, how to complete the data transfer from the EBS source tables to BIEE physical tables? which ETL tool is prefer for most developers? warehouse builder or Oracle Data Integration?BI apps comes with pre-built ETL mapping to use with the tools majorly with Informatica. Only BI Apps 7.9.5.2 comes with ODI but oracle has plans to have only ODI for any further releases.
    4) During data transfer phase, if there are many many large volume data needs to transfer, how to keep the completeness? for example, it needs to transfer 1 million rows from source database to BIEE physical tables, when 50%is completed, the users try to open the BIEE report, can they see the new 50% data on the reports? is there some transaction control in ETL phase?User will still see old data because its good to turn on Cache and purge it after every load.
    Refer..http://www.oracle.com/us/solutions/ent-performance-bi/bi-applications-066544.html
    and many more docs on google
    Hope this helps

  • Two questions about the new iWeb

    Hi
    I've got two questions about the new iWeb.
    1. Is it possible to blog online now? Meaning adding a new blog entry without having to be on your own Mac? This is a feature I've been waiting for since iWeb first was released.
    2. Is it possible to choose the format of images? Earlier editions had the option to "optimize" images but that meant it changed it into .png meaning the site got a lot heavier than if .jpg was used. And since I have relatives who still only have an isdn connection I need to be able to have the website as light as possible.
    thanks

    Ah well... thanks for the quick answer
    Message was edited by: Guðlogi

  • Question about the sensor... just got my 4s yesterday after screwing up my 3 with the laterd version update.  EVery call I have been on has either changed to speaker, called another number or ended the call or activated facetime, which I have turned off.

    Question about the sensor... just got my 4s yesterday after screwing up my 3 with the laterd version update. EVery call I have been on has either changed to speaker, called another number or ended the call or activated facetime, which I have turned off. never had this trouble with my 3...I don't even want to talk to anyone on this phone! Is the sensor bad? That is what the AT&t rep suggested.

    Restore as new... if the problem still continues then there is a hardware issue.
    If it stops after a restore as new, then the issue is with the backup the device is currently setup with.

  • Question about the ability of Genius Bar to help with outside software...

    Hi I wasn't sure where to put this, but here's my question. I'm having a problem with the Sims 2 on my Macbook and I was wondering if I go to the Genius Bar will they be able to help me or are they strictly hands off when it's not a direct Apple product?
    Also, I bought an external hard drive in the Apple Store but it's not an Apple branded product. If I'm having a problem with that, can I go to the Apple Store?

    If it's a question about the installation, system requirements or compatibility with your MacBook, the Mac Genius can probably help. If you're having some kind of issue while using the Sims 2, you'll probably have to contact .
    The same is true with the hard drive. If you need some help getting it connected or even formatted, they can probably help. However, if it's not powering up or you're losing files or some kind of operational issue with the hard drive after it's connected, they'll probably refer you to the manufacturer.
    Usually Apple can't support other vendors' products. Someone here may be able to give you some more advice, since none of us work for Apple. There may be someone here who's already had the same issue with the Sims.
    -Doug

  • Question about the programming of a legend

    Hello everybody,
    I have a question about the programming of a waveform's legend. I
    already asked here in this forum about the legend programming (03)
    months ago.
    I went satisfied but I ve just noticed that this code
    (See Code old_legend_test.llb with main.vi as main function) operates a
    little different from my expectances.
    Therefore I have a new question and I want to know if it
    is possible by labview programming to plot and show, on a waveform
    chart, a signal with activ plot superior to zero (0) without to be
    obliged to plot and show a signal with activ plot equal to zero (0) or
    inferior to the desired activ plot.
    I give you an example
    of what I m meaning. I have by example 4 signals (Signal 0, 1, 2 and 3)
    and each signal corresponds respectively to a channel (Chan1, Chan2,
    Chan3, Chan4). I want to control the legend (activ plot, plot name and
    plot color) programmatically. Is it possible with labview to plot signal
    1 or 2 or 3 or (1, 3) or (2,3) or (1,2,3) or other possible combination
    without to active the signal with the corresponding activ plot zero
    (0)?
    Let see the labview attached data
    (new_legend_test.llb with main.vi as main function). When I try to
    control the input selected values again I get them back but I don't
    understand why they have no effect on the legend of my waveform chart.
    Could somebody explain me what I m doing wrong or show me how to get a
    correct legend with desired plots? Thank by advance for your assistance.
    N.B.
    The
    both attached data are saved with labview 2009.
    Sincerly,PrinceJack
    Attachments:
    old_legend_test.llb ‏65 KB
    new_legend_test.llb ‏65 KB

    Hi
    princejack,
    Thanks for
    posting on National Instruments forum.
    The behavior
    you have is completely normal. You can control the number of row displayed in
    the legend and this rows are linked to the data you send to your graph. Thus,
    if you have 3 arrays of data, let say chan1, chan2 and chan3, you can choose
    which data you want to display in your graph using the property node (Active
    plot and visible). But for the legend as you send 3 plots there is an array of
    the plot name [chan1, chan2, chan3] and you can display 0, 1, 2 or 3 rows of
    this array but you cannot control the order in this array! So, to be able to
    change this array you have to only send data you need to you graph. I'm not
    sure my explanations are clear so I have implemented a simple example doing
    that.
    Benjamin R.
    R&D Software Development Manager
    http://www.fluigent.com/
    Attachments:
    GraphLegend.vi ‏85 KB

Maybe you are looking for