Current running sql statement in procedure?

How to identify the current running sql statement in procedure or package? From the v$sqlarea, i can see the only procedure name with parameters, but not current execution statement? is there any dba view to know the current execution statement in 9i & 10g ?

hi
u can also use dba_source view to know which sql statement issued by which user

Similar Messages

  • Run SQL statements from a textbox

    Hi
    I'm trying to execute multiple insert/update or Delete statements from a textarea of a page. I'm basically trying to replicate the same functionalility as SQL Workshop for users to access and run sql statements for it.
    I know in SQL workshop you can run multiple insert/update or delete statements using the following syntax:
    begin
    insert into table_1 (col1,col2)values('WER','QWE');
    Insert into table_1 (col1,col2)values('ABC','DEF');
    End;
    I have created a textarea called :P1_SQL with a submit button which when pressed it runs the execute immediate :P1_SQL. It works if its a single insert command. I've tried the begin...end option which bring up the following error message:
    ORA-06550: line 1, column 6: PLS-00103: Encountered the symbol "" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe The symbol "begin was inserted before "" to
    Any ideas how I could get this to work?
    Message was edited by:
    Funkymonkey2

    The process code that I have is as follows:
    Declare
    l_sql varchar2 (4000);
    begin
    l_sql := :P3_SQL;
    execute immediate l_sql;
    End;
    in the textarea I had entered the following
    begin
    insert into TBL_TEST_SQL(name,useR_id)values('abc','erf' );
    insert into TBL_TEST_SQL(name,useR_id)values('dec','erf');
    end;
    I was actually hoping to concatanate the 'begin...' part and the 'end;/' part on to the beginning and end of the sql statements.
    Any ideas??

  • Detect I/O before running sql statement

    Hi all,
    how do I detect I/O before running sql statement?

    do you mean:
    how do I know how much I/O is occurring before running a query?
    or
    how do I know how much I/O will be used to retrieve the data for this query?
    Which OS? You can look at OEM and "top" to see your current I/O. Detecting and deciding on whether or not you want to continue to submit the query is another problem.
    The question is: what problem are trying to solve? Is it really a problem or just something you imagine might occur???
    Don't try to fix a non-existent problem.

  • RMAN-10006: error running SQL statement: alter session set remote_dependenc

    Backups are failing with following error
    RMAN-00554: initialization of internal recovery manager package failed
    RMAN-12001: could not open channel default
    RMAN-10008: could not create channel context
    RMAN-10002: ORACLE error: ORA-00096: invalid value SIGNATURE for parameter remote_dependencies_mode, must be from among MANUAL, AUTO
    RMAN-10006: error running SQL statement: alter session set remote_dependencies_mode = signature
    Not able to change to signature
    SQL> alter session set remote_dependencies_mode=signature;
    ERROR:
    ORA-00096: invalid value SIGNATURE for parameter remote_dependencies_mode, must
    be from among MANUAL, AUTO
    I dont see MANUAL or AUTO as valid value for this parameter (http://download.oracle.com/docs/cd/B10501_01/server.920/a96536/ch1175.htm#1023124) DB version is 9.2.0
    Parameter type
    String
    Syntax
    REMOTE_DEPENDENCIES_MODE = {TIMESTAMP | SIGNATURE}
    Default value
    TIMESTAMP
    Parameter class
    Dynamic: ALTER SESSION, ALTER SYSTEM
    =======================================
    I believe it could be because of following bug
    "A PRE-PATCHED ORACLE IMAGE CAN BE INSTALLED IN MEMORY "
    Refer: "https://metalink2.oracle.com/metalink/plsql/f?p=130:15:1613505143885559758::::p15_database_id,p15_docid,p15_show_header,p15_show_help,p15_black_frame,p15_font:BUG,4610411,1,1,1,helvetica"
    I appreciate your effort in fixing this issue.
    Edited by: user10610722 on Nov 25, 2008 4:37 PM

    Hi:
    It seems when you are starting RMAN it's executing some commands (one 'ALTER SESSION...'. It's seems to be a batch which has a bad value for SORT_AREA_SIZE. Find it and modify to a proper value as message shows. If you can't find start RMAN by calling directly the executable ($ORACLE_HOME/bin/rman or %ORACLE_HOME%/bin/rman.exe).

  • Where to run SQL statements in Oracle Database 11gR1 ?

    Folks,
    Hello. I have just installed Oracle Database 11gR1 and login to Database Control page. There are 4 tabs on the top: Database, Setup, Preference, Help and Logout.
    I just create a table "table1" in "Database" tap. But I don't see anywhere to run SQL statement such as Select, Insert, Update.
    Can any folk tell me where to run SQL statements in Oracle Database 11gR1 ?
    Or
    Can any folk provide a User Manual for Oracle DB 11gR1 ?

    You can run from a terminal or install an SQL client and connect from there.
    http://www.articlesbase.com/databases-articles/how-to-install-oracle-11g-client-1793770.html
    Best Regards
    mseberg
    Assuming you have an oracle OS user on Linux you can try typing sqlplus at you OS command prompt. Generally you will have a .bash_profile with setting like this:
    # User specific environment and startup programs
    PATH=$PATH:$HOME/bin
    export PATH
    # Oracle Settings
    TMP=/tmp; export TMP
    TMPDIR=$TMP; export TMPDIR
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=/u01/app/oracle/product/11.2.0
    #export DISPLAY=localhost:0.0
    export TZ=CST6CDT 
    export ORACLE_SID=ORCL
    export ORACLE_TERM=xterm
    #export TNS_ADMIN= Set if sqlnet.ora, tnsnames.ora, etc. are not in $ORACLE_HOME/network/admin
    export NLS_LANG=AMERICAN;
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    export LD_LIBRARY_PATH
    # Set shell search paths
    PATH=/usr/sbin:$PATH; export PATH
    export PATH=$PATH:$ORACLE_HOME/bin
    # CLASSPATH:
    CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
    export EDITOR=vi
    set -o vi
    PS1='$PWD:$ORACLE_SID >'Edited by: mseberg on Jul 11, 2011 3:18 PM

  • Current running SQL stms execution plan?

    Hi,
    Is it any ways to findout the current running SQL stms execution plan?
    without using Explain plan & autotrace.
    Thanks in advance,
    Thomas.

    I'm using this code. You just have to give the Session Identifier (&SID ):SELECT     '| Operation                                     |  Objet   | Lignes| Bytes|  Cout  | Pstart| Pstop |' as "Plan Table"  FROM DUAL
    UNION ALL
    SELECT     '----------------------------------------------------------------------------------------------------' FROM DUAL
    UNION ALL
    SELECT * FROM
             (SELECT /*+ NO_MERGE */
              RPAD('| '||
                   SUBSTR(
                        LPAD(' ',1*(LEVEL-1)) || OPERATION || DECODE(OPTIONS, NULL,'',' '||OPTIONS), 1, 47
                         ), 48, ' '
              )||'|'||
              RPAD(
                   SUBSTR(OBJECT_NAME||' ',1, 9), 10, ' '
              )||'|'||
              LPAD(
                   DECODE(CARDINALITY,
                        NULL,'  ',
                        DECODE(SIGN(CARDINALITY-1000),
                              -1, CARDINALITY||' ',
                             DECODE(SIGN(CARDINALITY-1000000),
                                   -1,TRUNC(CARDINALITY/1000)||'K',
                                  DECODE(SIGN(CARDINALITY-1000000000),
                                       -1,TRUNC(CARDINALITY/1000000)||'M',
                                       TRUNC(CARDINALITY/1000000000)||'G')
                        ), 7, ' '
              )||'|'||
              LPAD(
                   DECODE(BYTES,
                        NULL,' ',
                        DECODE(SIGN(BYTES-1024),
                             -1, BYTES||' ',
                             DECODE(SIGN(BYTES-1048576),
                                  -1, TRUNC(BYTES/1024)||'K',
                                  DECODE(SIGN(BYTES-1073741824),
                                       -1,TRUNC(BYTES/1048576)||'M',
                                       TRUNC(BYTES/1073741824)||'G')
                        ), 6, ' '
              )||'|'||
              LPAD(
                   DECODE(COST,
                        NULL,' ',
                        DECODE(SIGN(COST-10000000),
                             -1, COST||' ',
                             DECODE(SIGN(COST-1000000000),
                                  -1, TRUNC(COST/1000000)||'M',
                                  TRUNC(COST/1000000000)||'G')
                        ), 8, ' '
              )||'|'||
              LPAD(
                   DECODE(PARTITION_START,
                        'ROW LOCATION', 'ROWID',
                        DECODE(PARTITION_START,
                             'KEY', 'KEY',
                             DECODE(PARTITION_START,
                                  'KEY(INLIST)', 'KEY(I)',
                                  DECODE(SUBSTR(PARTITION_START, 1, 6),
                                       'NUMBER', SUBSTR(SUBSTR(PARTITION_START, 8, 10), 1,LENGTH(SUBSTR(PARTITION_START, 8, 10))-1),
                                       DECODE(PARTITION_START,
                                            NULL,' ',
                                            PARTITION_START)
                        )||' ', 7, ' '
              )||'|'||
              LPAD(
                   DECODE(PARTITION_STOP,
                        'ROW LOCATION', 'ROW L',
                        DECODE(PARTITION_STOP,
                             'KEY', 'KEY',
                             DECODE(PARTITION_STOP,
                                  'KEY(INLIST)', 'KEY(I)',
                                  DECODE(SUBSTR(PARTITION_STOP, 1, 6),
                                  'NUMBER', SUBSTR(SUBSTR(PARTITION_STOP, 8, 10), 1,LENGTH(SUBSTR(PARTITION_STOP, 8, 10))-1),
                                  DECODE(PARTITION_STOP,
                                       NULL,' ',
                                       PARTITION_STOP)
                   )||' ', 7, ' '
              )||'|' AS "Explain plan"
         FROM V$SQL_PLAN
         START WITH (ADDRESS = (SELECT SQL_ADDRESS FROM V$SESSION WHERE SID=&SID)
                   AND HASH_VALUE = (SELECT SQL_HASH_VALUE FROM V$SESSION WHERE SID=&SID)
                   AND CHILD_NUMBER = 0
                   AND ID=0 )
         CONNECT BY PRIOR ID = PARENT_ID
                        AND PRIOR ADDRESS = ADDRESS
                        AND PRIOR HASH_VALUE = HASH_VALUE
                        AND PRIOR CHILD_NUMBER = CHILD_NUMBER
         ORDER BY ID, POSITION)
    UNION ALL
    SELECT '----------------------------------------------------------------------------------------------------' FROM DUAL;Regards,
    Yoann.

  • Run sql statements in PL/Sql Developer without installing Oracle database?

    Hi all,
    I wish to ask is there any possibility to run Run sql statements in PL/Sql Developer without installing Oracle database?
    Regards.

    Hello Jimmy,
    this is the forum for the tool SQL Developer and, as the title says, *(Not for general SQL/PLSQL questions)*.
    PL/Sql Developer is not an Oracle tool, but from allound allroundautomations.
    And you need access to a database to run SQL statements. This does not need to be one installed by yourself.
    Regards
    Marcus

  • Applescript to run SQL Server stored procedure on Mac

    Hello All,
    I'm new to applescript. I've a stored procedure in SQL server that generates a uniqque Jobnumber. I need to run this stored procedure from applescript and display the new job number to the user. How can I achieve this using Applescript? Is there any other alternative? Any suggestion/inputs are welcome.
    Thanks

    There's no simple, direct MySQL interface within AppleScript - that is, you can't (easily) connect to your database directly and execute the stored procedure.
    The commonest solution to this is to use the command line mysql interface via do shell script.
    set myData to (do shell script "/usr/local/mysql/bin/mysql -u USERNAME -pPASSWORD -e '<SQL statement here>'")
    There's a lengthy discussion, including examples, at http://macscripter.net/viewtopic.php?id=24721

  • Finding the currently executed SQL statement

    Hi,
    We have some users who have submitted some SQL statements which have been running for a very long time.
    Please let me know how to find out the SQL which is being currently being executed and also is it possible to find an estimated time of completion for the statement.
    Regards,
    VN

    You've posted enough to know you need to provide your 4 digit Oracle version.
    >
    We have some users who have submitted some SQL statements which have been running for a very long time.
    Please let me know how to find out the SQL which is being currently being executed and also is it possible to find an estimated time of completion for the statement.
    >
    You can query V$SESSION_LONGOPS. See my reply in this recent thread
    Re: SQL query to see what the db/schema is doing

  • Execute Dynamic SQL statement using procedure builder

    i want to execute a dynamic SQL statment using procedure builder not using forms
    because my statement depending on a variable table name
    i know that i can do that from forms using
    FORMS_DDL('SQL_STAT');
    but i wanna to use the procedure builder
    which function i should use and how?
    please explain in example if you don't mind.
    thanks

    Hi,
    You can very well use DBMS_SQL Package supplied by Oracle for doing this.
    Search for DBMS_SQL in OTN. You will get all info regarding this.
    Regards.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by itslul:
    i want to execute a dynamic SQL statment using procedure builder not using forms
    because my statement depending on a variable table name
    i know that i can do that from forms using
    FORMS_DDL('SQL_STAT');
    but i wanna to use the procedure builder
    which function i should use and how?
    please explain in example if you don't mind.
    thanks<HR></BLOCKQUOTE>
    null

  • Sender JDBC adapter : Update SQL Statement : stored procedure

    Hi,
    Can we use a stored procedure in the sender jdbc adapter in 'Update SQL Statement'.
    The problem i am facing is like, we are selecting data from two tables in 'SQL statement for query' and then in 'Update SQL Statement' , we need to delete that data from these two tables.
    Please let me know if it is possible.
    Thanks,
    Rohit

    you can use a Stored procedure in the
    Query SQL Statement
    You have the following options:
    ·        Specify a valid SQL SELECT statement to select the data to be sent from the specified database.
    ·        Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
    The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs.
    so have your whole select and update as part of this single Stored procedure

  • Run sql statement in green screen

    dear as/400 guru,
    i wonder how to execute sql statement in green screen ?
    my statement would be something as below
    select mandt from sapr3.usr02 where bname='kent';
    basically i want to check my id "kent" is available in which clients in an instance. and i was advised to run above sql statement.
    comment and advice will be highly appreciated.
    thanks
    regards,
    kent
    as/400 newbie

    Hi Kent,
    if you are looking for something, that reminds the old SQLs and uses a "/" for the delimiter, get the free STR(CON)SQL tool :
    http://www.easymarketplace.de/strsql-sqlutil.php
    If you do not receive a mail within 15 minutes, please drop me a mail, I will then reply with the user & pwd ...
    Regards
    Volker Gueldenpfennig, consolut international ag
    http://www.consolut.de - http://www.4soi.de - http://www.easymarketplace.de

  • Is it that we cannot run sql statement in main??

    Hi all,
    sorry to bother again. But i have some problems. I had a program that have main method and some other small methods that contains some sql statement that call the db to retrieve info. But it keep on prompting me error: "Connection refused. Check that the hostname and port is correct, and that the postmaster is running with the -i flag, which enables TCP/IP networking.".
    My program reside in the server but i really don't why i cannot run it. Is it because the main program cannot run with database and sql statement.
    Please reply asap. Thank You!

    This sound very much that your postgress isn't running (or if it isn't it wasn't started with the -i flag)
    Are you sure postgres (=postmaster) is running
    Thomas

  • Run SQL statement from APPS

    Hello
    I have SQL statement with parameters and I want client to run it from APPS.
    What should I do for this.

    What client are you talking about? Something like sql*plus? Or do you mean the Oracle Apps GUI front end?
    The best way is to properly set this up as a concurrent request. That will allow the user to enter any parameters and run it whenever. But that's an issue for a different forum.
    Whatever you do, don't give out the apps password <shudder>

  • Current Exact sql statement

    Dear Group
    Can any one suggest how can i see the Exact sql which was fired from the application.
    SELECT SQL_TEXT
    FROM V$SQLAREA
    WHERE (ADDRESS, HASH_VALUE) IN
    (SELECT SQL_ADDRESS, SQL_HASH_VALUE
    FROM V$SESSION
    WHERE SID = &sid_number)
    I mean with out "SYS_B_0" in the sql statement
    Thank you
    Message was edited by:
    Paddy01

    Hi,
    The value you are looking for is called as bind value.
    If you are on 8i, I am not sute how you will find the value. You can certainly it in the trace file.
    In 9i onwards, there is a view, v$sql_bind_data, which shows the bind value. But, still it is tricky.
    Regards
    Rahul

Maybe you are looking for

  • Acrobat Pro 10.12 not possible to sign a pdf with a valid cert

    Hello, Under Windows 7 x64, it's not possible to sign a PDF with a valid certificate. Clicking the sign button gives no response and no message what so ever. When using a non valid certificate as in not certified to use for signing, it is accepted an

  • Need help with 865MS-LS MB startup problems

    I recently purchased an 865GM2-LS motherboard in order to use with a new computer that I am building. After making sure everything was attached, I tried to boot the system by turning the power on. But, the machine beeped and an error came up, saying

  • Cisco Jabber Demo license

    Guys, Our company is willing to implement Cisco Jabber 9 but they require some sort of demo license to test the functionality of the solution, i have simply no idea about it, so need your help in this regard. BR. Abd

  • Illustrator CC 2014 crashing Mac when saving large file

    Hello, I hope someone can help, when I am working on a large file in Illustrator CC 2014 and working from with in my mac - not a network drive, my Mac resets its self and I get the power symbol, grey screen and text. Does anyone know why this happens

  • Document labels and discriptions distorted on Epson Stylus 3800 Pro

    I have a dozen photographers printing proofs to the Epson Stylus 3800 Professional.  The images, and the image labels that come from the Adobe Bridge CS4 "Contact Sheet II", all appear fine, but when adding the Description and Labels within the Outpu