How to access currently executing SQL statment?

Hello -
I have a C language external procedure that is called from an INSERT / UPDATE / DELETE trigger.
Is there a way (using OCI, or elsewhere) to get a string containing the SQL statment that fired the trigger?
Thanks a bunch for your help!
-js

http://databasejournal.com/features/oracle/article.php/3373701
The second page has more details (there is also a part II to this article if you are interested).

Similar Messages

  • Sql report, How to access current rows 6 columns data

    I have one page having page items & SQL report having 8 columns.
    First column of report is a link for editing.
    on clicking first column, that record gets displayed on page items, which are opn same page.
    Now my problem is i have used link column of report and set 3 page items value on click of link column.\
    But i need to set values for 2 more page items.
    I tried to create computation & process but not working. i am confused about which process point to select & whether onclick page gets submitted or not.
    I tried to write jscript but not succeeded. I dont know how to get current row id in jscript & different column values of current rowid.
    any help.

    Hi,
    Thanks for reply.
    in 5 items, first three are numeric and last two are timestamp fromtime, totime.
    as I mentioned earlier if i interchange 4 & 5 items i.e. now ITEM4 is totime & ITEM5 is fromtime
    and their values. I get value for totime & not for fromtime. all records contain values for all 5 columns. no null.
    So basically their is no problem in value or data, The only problem is whatever sequence is maintained first 4 items get value & 5th item remains blenk.
    Either I type all 5 ITEM NAMES in one Item name-value pair of link or use all three pairs, 5th ITEM remain blank.

  • 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

  • How to find top 10  SQL statments which are consuming more cpu time.

    hi all,
    Is there any command or script to monitor the top 10 sql statments which are consuming more cpu time.
    I know by using AWR REPORT we can find it, i want the command or script to find the top cpu utilization sql statments.
    Regards
    Subhash.

    Subhash,
    A quick and dirty Google search could have get you started with the following:
    Thread: how to get top CPU consuming sql oracle 10g
    Re: how to get top CPU consuming sql oracle 10g
    Oracle SQL top sessions
    http://www.dba-oracle.com/oracle10g_tuning/t_sql_top_sessions.htm
    "How to Find top 10 expensive sql's", version 9.2.0
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:73325450402303
    HTH,
    Thierry

  • What current executing SQL when Package is in flight

    I know I can use the SQL_ID in V$SESSION to identify the SQL statement that each session in V$SESSION is running. But what if the session is running a PLSQL block that includes many SQL statements. How can I tell which SQL statement it is currently on?
    For example I run procedure PERFORM_ETL which runs this:
    BEGIN
    insert into table1 select * from table 2;
    merge into table3 using blah blah blah;
    delete table4;
    END;
    How can I determine if the session is doing the insert, the merge or the delete?
    The SQL_ID in v$session only points to the perform_etl proc

    Usually your problem can be described with 'Who cares'. I mean, for what reason do you do this? I doubt that there's a business need to get 100 % accurate answers for this. Normally such things are used to get a picture about the growth of data.
    Personally I would prefer to have up-to-date statistics for all tables and just query the number of rows from there. Sufficient for me in < 99 % of all cases.
    Just my $ .02...

  • How to accessing current row report column value in Lov Query?

    Hi,
    which access methods (eg. bind variables, substitutions, ...) for getting the current row report column value can be used in the "Lov Query" property of a report column?
    As what I know of and what I have read on the forum there are no bind variables for the report columns. For the "Link Text" property it seems that the column values exist as substitution strings (#COLUMN_NAME#). But they don't work in the Lov Query. => And would be good because of a hard parse each time the Lov query is executed.
    The following post (Re: Simulating a correlated sub query in lov
    is showing a solution to use package variables for temporary storage of the referenced value, but the only problem with that solution is that if a new record is added with the "Add rows to tabular form" process the package variable still contains the value from the last queried row! Is there a way (variable, APEX package, ...) to determine if the lov query is executed for a new record so that the package can return null?
    I know that I could write the package in a way that the value is immediately cleared when lov_pkg.keyval is called (one time read), but then I would have to create several variables if I'm accessing the value multiple times in the query or in another query => I think an one time read solution would be very obscurely.
    Thanks for your help
    Patrick
    http://inside-apex.blogspot.com

    Hi Patrick,
    I agree that it's a waste to continually use Ajax to go back to the server to get the contents of a dynamic select list.
    There are no bind variables for any row item - but what you do have, as per my previous post, is the value of the data entered by the user in the first row. You can pass this into your application process (using get.add("VARIABLENAME", value)), which can use it to retrieve the correct LOV in your Ajax code - this will give you a "bind variable" that your process can use.
    What you could do, however, is generate hidden select lists on your page - one for each possible LOV list and replace the contents of the new row's select list with the contents of the appropriate hidden select list. This is easy to do with javascript (using innerHTML functions). Obviously, though, the usefulness of this depends on the number and size of the select lists.
    Even if you don't generate them to start with, you can keep a copy of any select lists returned by Ajax in the DOM for use on new rows. So, if you have retrieved a select list, you will have a copy of it in DOM which you can then copy into the new row. If you don't have the list in DOM, use Ajax to get it, store a copy of it and copy it into the new row.
    Which method you use will depend on the number/size of select lists needed. If they are few in number and/or size, I would suggest generating hidden lists. If they are large, use Ajax to get them once, store them and then retrieve them from the DOM when needed.
    There is another thread here where Arie recommends going to the server every time to make sure you get the most up-to-date data for the lists. If you want to follow this advice, for this reason, use get.add("VARIABLENAME", value) to pass the value to your process. If this is not an issue, you can use one of the other methods I outlined above.
    Regards
    Andy

  • How to access current system date???

    Hi Experts,
    I am working on a process wherein a user creates a proposal and a notification is sent to the manager for approval.
    Now i need to send the date of creation as a attribute to the manager.
    Can anyone guide me as to how to get the current system date???
    Thanks a lot.
    Cheers
    Gaurav Raghav

    Hi Wojciech Matulewicz,
    I have tried using this before and i faced this problem.
    When i click on create proposal, the screen just refreshes and the CO execution doesnt ends.
    Without ending this field, however things work fine.
    here is the code:
    Method technicalDescription()
    IGPAttributeInfo date = output.addAttribute("DATE", IGPAttributeInfo.BASE_DATE);
                date.setMultiplicity(IGPAttributeInfo.MULITIPLICITY_1_1);
    Method execute()
    Date currDate = new Date(System.currentTimeMillis());
              contextElement.setDate(currDate);
    Method complete()
    output.setAttributeValue("Date", wdContext.currentContextElement().getDate());
    If i comment out this code, the CO execution works out fine, but on addition of this code the screen refreshes and CO execution doesnt end.
    Am i doing something wrong???
    please help me out with this.
    Thanks.
    Cheers
    Gaurav Raghav

  • How to access Current Servlet Context from a java webservice class?

    Hi,
    I' am developing a Java Web Service Class, and I want to access some application settings information stored in the application context,
    but I couldn't get access to the current ServletContext?
    Note:
    I added my settings to the web.xml file in the WEB-INF folder.
    Normally I' am using getInitParameter(key) to get the value.
    Can any one help me please?
    Message was edited by:
    MySecreen

    Hi,
    I' am developing a Java Web Service Class, and I want
    to access some application settings information
    stored in the application context,
    but I couldn't get access to the current
    ServletContext?
    Note:
    I added my settings to the web.xml file in the
    WEB-INF folder.
    Normally I' am using getInitParameter(key) to get the
    value.
    Can any one help me please?
    Message was edited by:
    MySecreenI was faced with a similar issue, here's what worked for me:
    Have your class implement the ServiceLifecycle Interface and use it as you normally would, here's a sample
    import javax.xml.rpc.ServiceException;
    import javax.xml.rpc.server.ServiceLifecycle;
    import javax.xml.rpc.server.ServletEndpointContext;
    import javax.servlet.ServletContext;
    public class SomeClass implements ServiceLifecycle {
         private ServletContext sc = null;
    ....// rest of class code......
    public void init(Object arg0) throws ServiceException {
              ServletEndpointContext ctx;
              ctx = (ServletEndpointContext) arg0;
              sc = (ServletContext) ctx.getServletContext();
    ...}

  • How  to access database in Sql Server 7.0 using Java

    I am trying to access a database in SQL Server 7.0 using JDBC.But it is giving me errors.I have used following statements to connect the database
    private String URL = "jdbc:odbc:DatabaseName";
    private String userName="user";
    private String passWord="password";
    Class.forName( "sun.jdbc.odbc.SQLServerDriver" );
    connection = DriverManager.getConnection( URL,userName,"passWord" );
    where "username" and "password" are user Name and password respectively to access the database in SQL Server 7.0.

    I am sorry but I have written like;
    private String URL = "jdbc:odbc:DatabaseName";
    private String userName="user";
    private String passWord="password";
    Class.forName( "sun.jdbc.odbc.jdbcOdbcDriver" );
    connection = DriverManager.getConnection( URL,userName,"passWord" );
    where "username" and "password" are user Name and password respectively to access the database in SQL Server 7.0. And I have used the same name in "ODBC data source" as that of the database.I am trying some examples from book and these examples just work fine with MS Access( I created those databases in Access and tried the examples) but not with SQL Server 7.0. Do I need a separate driver or something?

  • How to fetch the executed sql query in publisher

    hi.. like in obiee from manage session we can fetch the sql query similarly how can we fetch the query in BI publisher

    This may help you:
    http://gerardnico.com/wiki/bip/log
    Cheers
    Nico

  • How to extract current user SQL password from SAP

    I have an external exe that needs to connect via ADO to the currently running SAP application using the current user.
    I used the SAPbobsCOM.Company object to extract the
    CompanyDB , Server ,DbUserName and Password to create my ADO connection string. But obviously the password is encrypted and (when I debug.print gives me ****) is not useful.
    Does anyone know how to get this password through the SDK?
    Thanks,
    Indika.

    Hi,
    I've already asked about it. No way. Simply forget.
    You can ask for password for the first time and store it in the database or in the registry.
    Regards,
    Mark
    Message was edited by: Mark Gulyansky

  • How to access current opened tabs in one copmuter from a different computer

    Hi ,
    I have 2 PC's & a android device , I want to access all the current opened tabs in PC 1 from PC 2.
    I do not want to use the History as it is too long and mixed ...

    Hi,
    Maybe the 'Sync'-option does work for you? Sync will synchronize your tabs. I think; when you login to Sync on your other device, the tabs will load automaticly. But I haven`t try it already. I hope it will work. :)

  • How to view previously executed sql commands?

    Hi experts,
    I want to view the sql commands executed in Oracle 8i before 3 or 4 hrs.That is i am asking to view the command history.Can any one help me in this weird situation?Anytype of suggestion were welcme..
    Thanx in Advance,
    Senthil

    You can use LOG MINER utility to check the commands that has been executed.
    Use v$log_history view to check the exact log sequence number of the redo log file, and there by you can use that log file with log miner.
    Using this method you can't see the DQL commands that has been executed against the database, apart from this all other commands can be seen..
    cheers
    kumareshan

  • Find the full sql text of the currently executing query

    Hi,
    I wish to find the full sql text of currently executing sql.
    Tried through v$sql and v sqltext_with_newlines but it doesn't give the full sql.
    We do not want to enable trace to get sql query.
    How to get this ?
    Thanks.

    Hye,
    I got my answer on the below link,
    Getting data from sql_fulltext
    Thanks.

  • How to execute SQL statement with oracle jdev

    Please I'm a beginner in oracle jdeveloper. I want to know how to use and execute sql statememt within oracle Jdeveloper 10 g release 3 to manipulate objects in oracle database. I want for e.g. to Enable/disable trigger using sql statement "ALTER TRIGGER trigername DISABLE" explicitly. Please tell me how to proceed.
    i am sure you can help me
    Sincerly yours.

    Hi,
    Using following tutorial http://www.oracle.com/technology/obe/ADF_tutorial_1013/10131/index.htm
    you will found how to connect from Jdev to a database (chapter 1 or 2 ?). Then you just have to go under Tool>SQL*Plus or Tools>SQL Worksheet depending on what you need.
    Luck,
    Tif

Maybe you are looking for

  • How do I find the name of the server?

    Hi all, I've finished a server program that returns a hard-coded html page via a socket but was hoping to make it as authentic as possible. Therefore is there a way of retrieving the server's name that I'm conecting to without using servlets? My code

  • Assigning value to a variable in Script Component.

    I'm pretty new to SSIS development and need to figure out a problem with assigning a value to a user defined variable. I created a pretty simple package. It reads a flat file, extracts date from a header record and subsequently uses derived column co

  • Using iPod as transferring device damaged song files

    I searched the forum for an hour-hour and a half, and haven't found anything. Here's the basis of what happened: I dragged my user folder by accident, and I needed to reinstall OS X. I usually transfer files with my iPod, and it always works, except

  • Belgium VAT declaration

    Hello Friends, has anybode came across the Belgium eVAT declaration configuration? if anybody come across please help me to find the solution for my issue? I have done the belgiam VAT declartion configuration as per the guide provided by SAP. but aft

  • Default dashBoard for Group

    Hi Gurus, How to set up default dashboard for a group of users..if i have 3 groups like g1,g2,g3..users need to get default page based on the group they belong to.