Question about AppleScript command.

I am looking for a command in AppleScript that will Operate a Key Binding. For example, I want to, in my script, have the computer use "Command-Shift-Z" without me touching the keyboard. I have looked through the entire AppleScript PDF from Apple and found nothing that could help me. I have considered using Terminal to create a script that fires the key binding, but I know very little about how to use Terminal. I have also played around with X11, (for about an hour and knowing nothing about what it is,) and that got me nowhere. There was a "bind" command in X11, but like I said, I have no idea what X11 is.
If AppleScript can't do this for me, could someone suggest a way of scripting that command some other way, then importing\implementing it in AppleScript?
I am basically trying to automate my dictation program by using Mac's built in "Speech" to start the program, then turn off "Speech" then turn on the microphone in the other program and open a new notepad to dictate to.
I have every part of the script down but the parts that require input from the keyboard....
Any help is GREATLY appreciated!

Thank you again for the help! I have figured it all out, thank god for apple having an easy laungage to understand! I'll post my script here and in the other forums, just incase someone is looking for something like this. I have kind of taken it upon myself to set my mac up to run, nearly, or totally, from voice commands.
Thank you again!
tell application "MacSpeech Dictate.app"
activate
end tell
tell application "System Events"
if UI elements enabled then
tell process "MacSpeech Dictate"
set frontmost to true
tell menu bar 1
tell menu "File"
click menu item "New Note Pad"
end tell
tell menu "Speech"
click menu item "Microphone On"
end tell
end tell
end tell
tell process "Finder"
key down {command, shift}
keystroke "z"
key up {command, shift}
end tell
tell process "MacSpeech Dictate"
set frontmost to true
end tell
end if
end tell
-------

Similar Messages

  • Two questions about AppleScript

    Hey,
    Just wondering:
    i) is there a way to make AppleScript wait for a certain amount of time?
    ii) is there a way to repeat the script over and over again?
    Cheers, Ricky.

    If you do just want a pause in the middle of a script, delay is the command you want:
    <pre class=command>delay 10</pre>
    However, I'm guessing your two questions are related - you want to run a piece of code periodically.
    In that case, the easiest way is to write an idle handler. This is called automatically, as often as you define:
    <pre class=command>on idle
    -- your code here
    return 60
    end idle</pre>
    If you save this as a 'Stay Open' script the code will run your code, then wait 60 seconds and run it again, and again, and again, until quit/cancelled.
    The return value indicates how long to wait before calling the idle handler again.

  • Geek Question About Terminal Command Prompt

    Strange Question:
    On my wife's Mac (10.9.5) her Terminal command prompts end with "%" (no quotes). On my Mac (also 10.9.5) my Terminal command prompts end with "$" (no quotes).
    This was also the case under Mountain Lion. Neither one of us has ever edited or created a .bash_profile settings file.
    Why the difference?
    Thanks.

    Her default shell is tcsh. Yours is bash.

  • A question about applescript

    Hi:
         I am learning applescript and trying to follwo example in books. I found that I can not change the width of name column under list view of Finder just as the examples. My script is as below:
    tell application "Finder"
      activate
              tell list view options of the front Finder window
                        tell column name column
                                  set its width to 2000
                        end tell
              end tell
              tell the front Finder window
                        set current view to list view
              end tell
    end tell
    tell application "Finder"
      activate
              tell list view options of the front Finder window
                        tell column name column
                                  get its width
                        end tell
              end tell
    end tell
    ==> I can set the value of "width". But I can find any change in the finder window.
                                                  Thanks!!!

    There is a problem with Finder windows reflecting scripted changes.
    You can get around this by closing and then re-opening the window after you make the change.  Something like this for the first part of your script.
    tell application "Finder"
      activate
              set thisFolder to target of front Finder window --<-- store the window
              tell list view options of the front Finder window
                        tell column name column
                                  set its width to 2000
                        end tell
              end tell
              tell the front Finder window
                        set current view to list view
      close --<-- close the window
              end tell
      open thisFolder --<-- re-open the window
    end tell

  • Beginner question about Applescript

    Hello,
    I'de like to know two things :
    - can I use Applescript on an application which does not have any dictionary ?
    - do you think it would be possible to make a script which would detect the opening of a window on this application, and automatically display this new window on the front screen ?

    Improved:
    set theApp to "yourapp"
    set windowcount to (count of windows of application theApp)
    repeat
    if ((count of windows of application theApp) > windowcount) then
      exit repeat
    else if ((count of windows of application theApp) < windowcount) then
    set windowcount to (count of windows of application theApp)
    end if
    end repeat
    --actions
    display dialog "Hey! A window was opened!"

  • Quick question about AppleScript and "current playlist."

    I have a few scrips that I'd like to have operate on whatever playlist is selected at the moment. The script dictionary has a "current playlist" object for iTunes, but it references the playlist the currently playing song is in, not the currently selected playlist. This is not what I want.
    I suppose I could make iTunes play, pause, then stop in my script, but it seems like there has to be an easier way. Suggestions?

    Hi,
    Someone in the Applescript Forum might be able to help:
    http://discussions.apple.com/forum.jspa?forumID=724
    Regards,
    Colin R.

  • Question about the command "ip unnumberd loopback0"

    Hello there!
    Could you share your experience with me?
    When I access to RAS from my PC through dialup connection, I get ip addresses of my ppp interface and nexthop.
    I wanted to know how the process was going on in the RAS. So I checked the configuration on the cisco web site.
    interface loopback 0
    ip address 192.168.1.1 255.255.255.0
    interface async1
    ip unnumbered loopback 0
    peer default ip address pool asyncpool
    router eigrp 100
    network 192.168.1.0 0.0.0.255
    network 10.1.0.0 0.0.255.255
    ip local pool asyncpool 192.168.1.2 192.168.1.254
    From the above, the RAS is configured for both async interface on RAS side and loopback interface to be assigned the same ip address as well as the two networks (async ppp and loopback) belong to the same ip network subnet.
    What's happening in the routing table of the RAS? How can the two different interfaces have the same ip address?
    I don't have any RAS. I can't check them out. Please help me with some advice.

    Thanks for your input!
    Could you help me one more?
    When the command "peer defaul ip address pool ciscopool" is configured on an async interface of RAS, which protocol is actually resposible for delivering an ip address to a client PC?
    I guess it could be ppp because there is no alternative. If it is ppp, which field of ppp packet is for the delivery function? I've never heard of this function in ppp.
    Thanks!

  • Question about AppleScript, iTunes and the app Proximity...

    So I have this application Proximity, which uses bluetooth's proximity to the cpu to run both an out-of-range script and and in-range script. I'm currently using it to activate my screensaver with password lock and vice versa. I'm also using it to sync my Bluetooth phone via iSync. Finally, I'm using it to pause and pause/play iTunes when I come and go from the cpu. The problem I was having was that if I had iTunes closed the script would still open it and then play the first tune. If iTunes is closed I don't want it to start playing. I came up with a workaround, but it seems a little sloppy. Here is what I came up with, but I want to make it as seamless and clean as possible. This is a script for when I enter the proximity of the cpu. If it's in a paused state it will play. If it's in a stopped state (it will quit) or closed from the get go, iTunes will open then subsequently quit.
    -- PlayPause iTunes
    tell application "iTunes"
    if player state is paused then
    playpause
    end if
    end tell
    tell application "iTunes"
    if player state is stopped then quit
    end tell

    How to Get Apps From the App Store Without a Credit Card
    http://ipadhelp.com/ipad-help/how-to-get-free-apps-from-the-app-store-without-a- credit-card/
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    http://support.apple.com/kb/ht2534
    If None is not available - On your computer launch iTunes and click "iTunes Store" in the left navigation pane. Click the "down arrow" next to your name at the top right side of the page and click "Account." Enter your username and password and click "View Account" to log into your account information. Next to your Payment Type, click "Edit." Select the "None" button and click "Done." Confirm that your card has been removed by returning to the Apple account information screen. Under Payment Type, it should say that there is no credit card on file.
     Cheers, Tom

  • Question about comment command

    I have to update comments on a lot of tables. I want to only update date them when the field is null.
    Does anyone know how this can be accomplished?
    I want something like COMMENT ON COLUMN TEST.REPORTS.ID IS 'Primary Key' where TEST.REPORT.ID IS NULL;
    Howard

    >
    I have to update comments on a lot of tables. I want to only update date them when the field is null.
    Does anyone know how this can be accomplished?
    I want something like COMMENT ON COLUMN TEST.REPORTS.ID IS 'Primary Key' where TEST.REPORT.ID IS NULL;
    >
    While adding comments can definitely be valuable I would suggest you take a different approach.
    1. Add comments at the table level first. The ALL_TAB_COMMENTS view lists OWNER, TABLE_NAME, TABLE_TYPE, COMMENTS. Then for column level comments it is the ALL_COL_COMMENTS view with OWNER, TABLE_NAME, COLUMN_NAME, COMMENTS.
    http://docs.oracle.com/cd/B28359_01/server.111/b28320/statviews_2092.htm#sthref1463
    2. Prioritize the tables you add comments to. Focus first on your most important key tables and columns. Adding comments to those will be more immediately useful than a shotgun approach to try to add comments to all tables and columns. Most environments have hundreds or thousands of tables so take care of the important ones first.
    3. A simple way to get started on your task is to create your own tables that are clones of the system views
    create table my_tab_comments as select * from user_tab_comments; -- or from ALL_TAB_COMMENTS with/without OWNER='SCOTT' e.g.
    create table my_col_comments as select * from user_col_comments
    alter table my_tab_comments add (modified_date date default sysdate)
    alter table my_col_comments add (modified_date date default sysdate)These tables become your working data and every record has a date.
    If you use a GUI like Oracle's free sql developer tool you can easily update the COMMENTS columns that are null and update the MODIFIED_DATE accordingly. You can also see the existing comments and perhaps update them if necessary.
    When you are ready to apply your changes use a script similar to what sb92075 has posted to extract the data from YOUR tables and create ALTER statements that will apply your comments.
    You can easily modify the script to apply just one table at a time if you want.
    By using your own work tables you make it easier to see what comments have already been written and to do the update is smaller, more manageable pieces. You can also let other developers comment their own tables so one person doesn't have to do it all.
    If you add new tables to a schema later it is easy to write a query to add them to your custom tables and create comments.
    When the project is finished you can either export your MY_TAB_COMMENTS and MY_COL_COMMENTS tables to a delimited, or Excel, file or create a big script to put into your version control system.
    That way you won't have to repeat the process later.

  • 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

  • CBWFQ: Question about the output of "show policy-map interface" command

    Hi everyone,
    I have a question about the output of "show policy-map interface" command.
    The following is the output of this command and lower side of the output shows
    (total queued/total drops/no-buffer drops) 0/342/0
    If the packets drop occur due to the situation of no enough buffer,
    "no-buffer drops" counted up. But "no-buffer drops" has not been counted up.
    The "no-buffer drops" is 0 (zero) but "total drops" are counted as 342.
    I guess there are other factors except "no-buffer drops" to add "total drops".
    But I can not find any information about "other factors".
    So I would like to know the "other factors" added to "total drops".
    reserch-3725#sh policy-map interface fastethernet0/1
    FastEthernet0/1
    Service-policy output: shaping
    Class-map: kdpc (match-all)
    146956873 packets, 115209221595 bytes
    5 minute offered rate 156000 bps, drop rate 0 bps
    Match: access-group name YOKOHAMA_to_CHINO
    Traffic Shaping
    Target/Average Byte Sustain Excess Interval Increment
    Rate Limit bits/int bits/int (ms) (bytes)
    9360000/9360000 58500 234000 234000 25 29250
    Adapt Queue Packets Bytes Packets Bytes Shaping
    Active Depth Delayed Delayed Active
    - 0 146956724 3539850811 2960247 3851843541 no
    Class-map: class-default (match-any)
    552458414 packets, 249687580329 bytes
    5 minute offered rate 242000 bps, drop rate 0 bps
    Match: any
    Traffic Shaping
    Target/Average Byte Sustain Excess Interval Increment
    Rate Limit bits/int bits/int (ms) (bytes)
    3072000/3072000 19200 76800 76800 25 9600
    Adapt Queue Packets Bytes Packets Bytes Shaping
    Active Depth Delayed Delayed Active
    - 0 552453209 573909865 30358216 2926188156 no
    Service-policy : policy1
    Class-map: dlsw (match-all)
    979578 packets, 264843255 bytes
    5 minute offered rate 0 bps, drop rate 0 bps
    Match: access-group name acl-dlsw
    Queueing
    Output Queue: Conversation 137
    Bandwidth 128 (kbps) Max Threshold 64 (packets)
    (pkts matched/bytes matched) 20922/17371500
    (depth/total drops/no-buffer drops) 0/0/0
    Class-map: telnet (match-all)
    29938 packets, 1806058 bytes
    5 minute offered rate 0 bps, drop rate 0 bps
    Match: access-group name acl-telnet
    Queueing
    Output Queue: Conversation 138
    Bandwidth 64 (kbps) Max Threshold 64 (packets)
    (pkts matched/bytes matched) 639/38900
    (depth/total drops/no-buffer drops) 0/0/0
    Class-map: class-default (match-any)
    551448911 packets, 249420939729 bytes
    5 minute offered rate 242000 bps, drop rate 0 bps
    Match: any
    Queueing
    Flow Based Fair Queueing
    Maximum Number of Hashed Queues 128
    (total queued/total drops/no-buffer drops) 0/342/0
    Your information would be appreciated.

    Details infomatiuon regarding show policy-map interface
    http://www.cisco.com/en/US/tech/tk543/tk545/technologies_tech_note09186a008010dd6a.shtml
    http://www.cisco.com/en/US/tech/tk543/tk760/technologies_tech_note09186a0080108e2d.shtml
    http://www.cisco.com/univercd/cc/td/doc/product/software/ios123/123cgcr/qos_r/qos_s2g.htm#wp1146884

  • Question about reading a string or integer at the command line.

    Now I know java doesn't have something like scanf/readln buillt into it, but I was wondering what's the easiest, and what's the most robust way to add this functionality? (This may require two separate answers, sorry).
    The reason I ask is because I've been learning java via self study for the SCJA, and last night was the first time I ever attempted to do this and it was just hellish. I was trying to make a simple guessing game at the command line, I didn't realize there wasn't a command read keyboard input.
    After fighting with the code for an hour trying to figure it out, I finally got it to read the line via a buffered reader and InputStreamReader(System.in), and ran a try block that threw an exception. Then I just used parseInt to get the integer value for the guess.
    Another question: To take command line input, do you have to throw an exception? And is there an easier way to make this work? It seems awfully complicated to take user input without a jframe and calling swing.
    Edited by: JGannon on Nov 1, 2007 2:09 PM

    1. Does scanner still work in JDK1.6?Try it and see. (Hint: the 1.6 documentation for the class says "Since: 1.5")
    If you get behaviour that doesn't fit with what you expect it to do, post your code and a description of our expectations.
    2. Are scanner and console essentially the same thing?No.
    Scanner is a class that provides methods to break up its input into pieces and return them as strings and primitive values. The input can be a variety of things: File InputStream, String etc (see the Scanner constructor documentation). The emphasis is on the scanning methods, not the input source.
    Console, on the other hand, is for working with ... the console. What the "console" is (and whether it is anything) depends on the JVM. It doesn't provide a lot of functionality (although the "masked" password input can't be obtained easily any other way). In terms of your task it will provide a reader associated with the console from which you can create a BufferedReader and proceed as you are at the moment. The emphasis with this class is the particular input source (and output destination), not the scanning.
    http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
    http://java.sun.com/javase/6/docs/api/java/io/Console.html

  • Question about broker Switchover command

    Hi guys
    i have one question about switchover cmd . For example, i have 1 primary database called stdby3 and 2 standby databases that are called stdby1 and stdby2. When i performed switchover cmd to stdby2 standby database, why the old primary database stdby3 could not become new standby database after i performed a switchover; furthermore the new primary and standby databases are not opened after the switchover process is completed
    output screen:
    DGMGRL> show configuration;
    Configuration
    Name: stdby1
    Enabled: YES
    Protection Mode: MaxProtection
    Databases:
    stdby3 - Primary database
    stdby1 - Physical standby database
    stdby2 - Physical standby database
    Fast-Start Failover: DISABLED
    Current status for "stdby1":
    SUCCESS
    DGMGRL> SWITCHOVER TO stdby2
    Performing switchover NOW, please wait...
    Operation requires shutdown of instance "stdby3" on database "stdby3"
    Shutting down instance "stdby3"...
    ORA-01109: database not open
    Database dismounted.
    ORACLE instance shut down.
    Operation requires shutdown of instance "stdby2" on database "stdby2"
    Shutting down instance "stdby2"...
    ORA-01109: database not open
    Database dismounted.
    ORACLE instance shut down.
    Operation requires startup of instance "stdby3" on database "stdby3"
    Starting instance "stdby3"...
    Unable to connect to database
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    Failed.
    You are no longer connected to ORACLE
    Please connect again.
    Unable to start instance "stdby3"
    You must start instance "stdby3" manually
    Operation requires startup of instance "stdby2" on database "stdby2"
    You must start instance "stdby2" manually
    Switchover succeeded, new primary is "stdby2"
    DGMGRL> show configuration;
    Error:
    ORA-01034: ORACLE not available
    Process ID: 0
    Session ID: 130 Serial number: 45
    DGMGRL> exit;
    oracle@localhost ~$ dgmgrl
    DGMGRL for Linux: Version 11.1.0.6.0 - Production
    Copyright (c) 2000, 2005, Oracle. All rights reserved.
    Welcome to DGMGRL, type "help" for information.
    DGMGRL> connect sys
    Password:
    Connected.
    DGMGRL> show configuration;
    Error:
    ORA-01034: ORACLE not available
    Process ID: 0
    Session ID: 0 Serial number: 0
    DGMGRL> connect sys@stdby3
    Password:
    Connected.
    DGMGRL> show configuration;
    Error:
    ORA-01034: ORACLE not available
    Process ID: 0
    Session ID: 0 Serial number: 0
    DGMGRL>
    Edited by: user6981287 on Jan 6, 2010 9:27 AM

    this is my configuration
    DGMGRL> show configuration
    Configuration
    Name: matrix
    Enabled: YES
    Protection Mode: MaxPerformance
    Databases:
    stdby1 - Primary database
    stdby2 - Physical standby database
    stdby3 - Physical standby database
    Fast-Start Failover: DISABLED
    Current status for "matrix":
    SUCCESS
    --- this is my first successful switchover -----
    DGMGRL> switchover to stdby2
    Performing switchover NOW, please wait...
    New primary database "stdby2" is opening...
    Operation requires shutdown of instance "stdby1" on database "stdby1"
    Shutting down instance "stdby1"...
    ORA-01109: database not open
    Database dismounted.
    ORACLE instance shut down.
    Operation requires startup of instance "stdby1" on database "stdby1"
    Starting instance "stdby1"...
    ORACLE instance started.
    Database mounted.
    Switchover succeeded, new primary is "stdby2"
    -------------------this is my second switchover -------------
    DGMGRL> switchover to stdby1
    Performing switchover NOW, please wait...
    New primary database "stdby1" is opening...
    Operation requires shutdown of instance "stdby2" on database "stdby2"
    Shutting down instance "stdby2"...
    ORA-01109: database not open
    Database dismounted.
    ORACLE instance shut down.
    Operation requires startup of instance "stdby2" on database "stdby2"
    Starting instance "stdby2"...
    Unable to connect to database
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    Failed.
    You are no longer connected to ORACLE
    Please connect again.
    Unable to start instance "stdby2"
    You must start instance "stdby2" manually
    Switchover succeeded, new primary is "stdby1"
    DGMGRL>
    Edited by: user6981287 on Jan 7, 2010 12:57 AM
    Edited by: user6981287 on Jan 7, 2010 1:00 AM

  • Some questions about configuration in MAX.

    Hello,everyone!
    I have some questions about configuration in MAX(I am a jackaroo for motion control development),I hope I can get your help.
    I use PCI-7344+UMI-7764+Servo amplifier+Servo motor,my MAX version is 4.2 and I use NI-Motion7.5
    My question as following:
    1,In Axis Configuration,for motor type,why I must select stepper but not servo?my motor is servo motor!If I select Servo,my motor can't run,I don't know why.
     If I select stepper,though motor can work but I can't test encoder in MAX.
    2,In Stepper settings,for stepper loop mode,why I must select open-loop but not close-loop?If I select close-loop,the servo motor doesn't work too.
    3,If I want my two servo motors run at different velocity,How shoud I do?It seems I just can set the same velocity in MAX for my two servo motors.
     My English is poor,Pls pardon me!I come from China.
    Thank you for your help!
    EnquanLi
    Striving is without limit!

    Hi,Jochen,
    Thank you for your kindly help!
    The manufacturer of the drive and motor that I am using now is Japan SANYO DENKI,drive type is RS1A01AA,motor type is R2AA06020FXP00.
    And I use position control mode,thehe encoder's counts per revolution is 131072.I set the electronic gear ratio to 1:1 for drive.
    Now,I can use Close-Loop to control the motor but still has some problems.When I configure it to run in closed loop mode, the motors behave strangely and never move to the target position.When I configure it to run in closed loop mode, the motors behave strangely and never move to the target position.The detail situation is as following
    1,Motor can't run.
    2, Or motor moves to a position, then moves in the same direction agian and eventually stops.
    Except for the  two points mentioned above,"Following Error" is  occured frequently,I don't know why.
    I am still not clear why I must set the motor type be stepper in MAX .
    And I have another question:what the relationship between the steps and the counts?They have the proportion relations?I notice that there are a section said like this in help document: For proper closed-loop and p-command operation, steps per revolution/counts per revolution must be in the range of 1/32,767 < steps/counts < 32,767. An incorrect counts to steps ratio can result in failure to reach the target position and erroneous closed-loop stepper operation.
    I am verry sorry I have too many questions!
    I am very appreciate for your kingly help!Thanks again!
    EnquanLi
    China
    Striving is without limit!

  • 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

Maybe you are looking for

  • Project No Longer Loads

    I have been working on a project for several weeks. Two days ago I tried to load it to work on it but after the progress bar reaches 100%, it just sits there. I tried starting another project and importing some video and it appears to work. The lost

  • Correct version of jdeveloper to use with Oracle App Server 10g 10.1.2.0.2

    Hi, I just want to be sure, I am new to JDeveloper and I would just like to verify/ask what correct version of JDeveloper should we use so we could deploy the finished applications on our Oracle Application Server 10g 10.1.2.0.2 without errors? Looki

  • Pager Notification Maximum Digits??

    Okay, I have a question for the Unity gurus Here's the situation: Subscriber needs to setup pager notification to a Nextel pager number. Subscribers must enable pager notification through the phone because they don't have access to the Active Assista

  • Calculation manager - error when importing .csc script

    Hi everybody, I am using EPM 11.2.1 with an Oracle 11.2.0.2 repository. I am new to Calculation Manager in Planning and I have an issue again. Using Essbase's admin console I created a script: SET UPDATECALC OFF; SET AGGMISSG ON;; FIX ("FY11", "Curre

  • My iTunes gift has not sent yet and it has past the schedule

    My iTunes gift has not been sent yet, and it has past the scheduled delivery date