Last ran query in the database

Hi ,
I need to know the last executed sql query in the data base.
I tried desc v_$sql , etc.. but it says 'table or view doesnot exist'..
So could you please let me know the way to find the last executed query .. :)

Not sure if you can retrieve the 'last ran sql' through querying v$SQL, but it looks you'll need some grants/privileges in order to be able to query the DataDictionary views. SELECT_CATALOG_ROLE, for example...
SQL> select * from v_$sql where rownum = 1;
select * from v_$sql where rownum = 1
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> select * from v$sql where rownum = 1;
SQL_TEXT
SQL_FULLTEXT                                                           
SERVICE                                                         
.....top secret code removed to prevent WW3...                                                           
1 row selected.

Similar Messages

  • The query against the database caused an error in https: site

    Hi
    I have created a new Data source and External content type in sharePoint 2013
    I have also given all the permission to this Content type (including "Users(Windows)")
    I also having edit permission in the Sql-database.
    I have tied almost all the possibilities given in the net for this error.
    still the error("the query against the database caused an error") is there.
    Is this because of "https:/ " in the url?
    Can any one give a suggestion / solution for this?
    Thanks
    S H A J A N

    Hi,
    Can you please check ULS Log as well as event viewer, to see if there's any related error reported?
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • How an INDEX of a Table got selected when a SELECT query hits the Database

    Hi All,
    How an Index got selected when a SELECT query hits the Database Table.
    My SELECT query is as ahown below.
        SELECT ebeln ebelp matnr FROM ekpo
                       APPENDING TABLE i_ebeln
                       FOR ALL ENTRIES IN i_mara_01
                       WHERE werks = p_werks      AND
                             matnr = i_mara_01-matnr AND
                             bstyp EQ 'F'         AND
                             loekz IN (' ' , 'S') AND
                             elikz = ' '          AND
                             ebeln IN s_ebeln     AND
                             pstyp IN ('0' , '3') AND
                             knttp = ' '          AND
                             ko_prctr IN r_prctr  AND
                             retpo = ''.
    The fields in the INDEX of the Table EKPO should be in the same sequence as in the WHERE clasuse?
    Regards,
    Viji

    Hi,
    You minimize the size of the result set by using the WHERE and HAVING clauses. To increase the efficiency of these clauses, you should formulate them to fit with the database table indexes.
    Database Indexes
    Indexes speed up data selection from the database. They consist of selected fields of a table, of which a copy is then made in sorted order. If you specify the index fields correctly in a condition in the WHERE or HAVING clause, the system only searches part of the index (index range scan).
    The primary index is always created automatically in the R/3 System. It consists of the primary key fields of the database table. This means that for each combination of fields in the index, there is a maximum of one line in the table. This kind of index is also known as UNIQUE. If you cannot use the primary index to determine the result set because, for example, none of the primary index fields occur in the WHERE or HAVING clause, the system searches through the entire table (full table scan). For this case, you can create secondary indexes, which can restrict the number of table entries searched to form the result set.
    reference : help.sap.com
    thanx.

  • Pagination resubmits the query to the database.

    I have a standard report fed by a dynamic query to retrive the data based on the parameter passed. All parameters reside on one page and the report it self is on a new page. When user clicks a go button the report is submitted with a dynamic query based on the user input parameters. The report some times takes a minute or two to capture the result set and display and depending on the number of rows fetched spans multiple Paginations. We recently noticed that every time the next x row arrow is clicked the page is resubmitted and the query to the database is resubmitted and this is a bad experience to the user to wait another minute for the page to return next x rows. Please help resolve this issue.

    Hi User XY,
    this is the standard APEX behaviour, every time you want a new subset (get next/previous page) the query is executed again.
    You can:
    - read all rows at once
    - tune your datamodel and/or query to get faster response
    - prepare the data in an APEX Collection (e.g. with APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY*) and let your report read from the collection
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    BuilderPlugin: http://builderplugin.oracleapex.info
    Work: http://www.click-click.at

  • Metdata Query Crippling the Database

    Hi All,
    We are using
    ResultSet getProcedureColumns(String catalog,
                   String schemaPattern,
                   String procedureNamePattern,
                   String columnNamePattern) throws SQLException;
    method of the interface DatabaseMetaData. We have observed that the following query is issued to the database which is consuming a lot of CPU resource.
    SELECT package_name AS procedure_cat,
    owner AS procedure_schem,
    object_name AS procedure_name,
    argument_name AS column_name,
    DECODE(position, 0, 5,
    DECODE(in_out, 'IN', 1,
    'OUT', 4,
    'IN/OUT', 2,
    0)) AS column_type,
    DECODE (data_type, 'CHAR', 1,
    'VARCHAR2', 12,
    'NUMBER', 3,
    'LONG', -1,
    'DATE', 93,
    'RAW', -3,
    'LONG RAW', -4,
    1111) AS data_type,
    data_type AS type_name,
    DECODE (data_precision, NULL, data_length,
    data_precision) AS precision,
    data_length AS length,
    data_scale AS scale,
    10 AS radix,
    1 AS nullable,
    NULL AS remarks,
    sequence,
    overload,
    default_value
    FROM all_arguments
    WHERE owner LIKE :1 ESCAPE '/'
    AND object_name LIKE :2 ESCAPE '/'
    AND package_name IS NULL
    AND (argument_name LIKE :3 ESCAPE '/'
    OR (argument_name IS NULL
    AND data_type IS NOT NULL))
    ORDER BY procedure_schem, procedure_name, overload, sequence
    I would like to know:
    i) If the method getProcedureColumns() internally uses this query. (We are using thin driver from Oracle - classes12.zip)
    ii)Please note that this high load on CPU happens only if we invoke a particular procedure. What might have gone wrong?
    Thanks in advance.

    Problem solved. In new database, I have added a new field and the external content type was not updated based on this new field hence the error.

  • How to adjust adhoc query when the database table changed.

    DearFreinds,
            I have created an adhoc Query , however after few days there was a requirement to remove some fields and change the length of some fields . Now the Adhoc query showing as to adjust , however when iam trying to adjust nothing is happening. Could any one let me know how to adjust with the table strucutre in the adhoc query.
    Regards
    madhu.

    Hi Sumit,
           Yes i have adjusted the database from se11 itself by going into utlity > adjust database . However i can still see the
    adhoc query -> infoset asking me when iam trying to go in change mode saying the database table has been changed do you want to adjust . 
    I have adjusted by going to more functions still there is no change. Please let me know what exactly i have to do.
    regards
    madhu

  • I am using the database connectivity toolkit to retrieve data using a SQL query. The database has 1 million records, I am retrieving 4000 records from the database and the results are taking too long to get, is there any way of speeding it up?

    I am using the "fetch all" vi to do this, but it is retrieving one record at a time, (if you examine the block diagram) How can i retrieve all records in a faster more efficient manner?

    If this isn't faster than your previous method, then I think you found the wrong example. If you have the Database Connectivity Toolkit installed, then go to the LabVIEW Help menu and select "Find Examples". It defaults to searching for tasks, so open the "Communicating with External Applications" and "Databases" and open the Read All Data. The List Column names just gives the correct header to the resulting table and is a fast operation. That's not what you are supposed to be looking at ... it's the DBTools Select All Data subVI that is the important one. If you open it and look at its diagram, you'll see that it uses a completely different set of ADO methods and properties to retrieve all the data.

  • How To Save Modified Fields After query From The Database

    I Have This Customer Information Form That's Sort of an Ordering Forms , I Made It By LiveCycle v9.0
    And I Want To be able to search for Specific Record and Modify it and Save It Again to The DataBase
    I believe That We All Saw The (( Data Connected Forms Presentation )) For Pual Guerette
    At One Part Of The Presentation (Minute 0:26:00 specifically) When He Try To Search A Specific Record In the Database
    And He Got all this annoying Messages Then The Record what He looking Shows up ; He Said That We No Longer able to Modify The Record After We Doing the Search
    My First Question Is Why ???
    Is there anyway After I got that Specific Record I Want from the Database I Can make my modification on it and update it Back in the DB.
    OR i Have to Browse the whole DB looking for it Specially that I got this (ID Auto Increasment Number field Issue) Which leads me to ;
    My Second Qustion;
    Why I Can't just connect ''The Form Order Number'' to an Auto Increasment Number field in the DB
    Obviously i can't, So Can I do Anything to achieve this goal ??
    I Believe that we can Find some scripting to make that Happen 
    I Will Be So Grateful If There Is Any Helpful Answer
    FYI: I'm Not Java Expert So If There Is any Coding That's Can be Helpful Please POST ALL OF IT if you can ,,,,

    Hi,
    The information there is excellent and I would strongly recommend it.
    I don't have any public database examples and I am not inclined to spend time preparing an example if you are not prepared to read up on the methods.
    Stefan's site is the only link I have for databases.
    Good luck,
    Niall

  • Copy the Last Record queried to the new record in a Multi - Record Block

    Hi Team
    When i enter a new record in a Multi - Record Block the last record should get copied to the new record.
    Please help me.
    Thanks

    Hi
    pls use...
    DUPLICATE_RECORD;Amatu Allah

  • Is there a way to force a View Object to query the database always?

    Dear All,
    Is there a way to force a view object to always scan the database table to read the latest data?
    Here's my use case.
    I have a page that loads data then I have a button which executes the following code.
    viewObject.setApplyViewCriteriaName("SampleCriteria");
    viewObject.setNamedWhereClauseParam("arg1", "test");
    viewObject.executeQuery();
    RowSetIterator it = viewObject.createRowSetIterator(null); 
    while(it.hasNext()) {
         /* More Code */
    }Suppose after page load, I edited some row in the table and then I clicked the button. I notice that my edited row
    was not reflected in the query.
    I am not sure but is there some configuration to check so that when the viewobject executes it will always query the data
    from the table?
    I am thinking that there is some level of caching and I want to disable it. If I restart my application, I notice that it is able to read the latest data.
    JDEV 11.1.1.5

    By default a view object performs its query against the database to retrieve the rows in its resulting row set. However, you can also use view objects to perform in-memory searches and sorting to avoid unnecessary trips to the database.
    The view object's query mode controls the source used to retrieve rows to populate its row set. For more details please refer: http://docs.oracle.com/cd/B31017_01/web.1013/b25947/bcadvvo005.htm
    Also, see if this helps: setQueryMode for secondary rowSet not working

  • How to find last executed query

    Hello,
    I want to find the last executed query in the Oracle database.
    Can anybody help me, how can I find last fired query.
    I am using following query for it, but it gives me the same query as in the result.
    SELECT SQL_TEXT FROM V$SQL
    WHERE ADDRESS = (SELECT SQL_ADDRESS
    FROM V$SESSION
    WHERE AUDSID = USERENV('SESSIONID'))
    Please help me.Thanks.

    Hi,
    select sa.sql_text,ss.username
    from v$session ss, v$sqlarea sa
    where sa.hash_value = ss.prev_hash_value
    SQL> /
    SQL_TEXT
    USERNAME
    DELETE FROM T
    HR
    GRANT SELECT ON T TO
    HR
    SELECT COUNT(*) FROM HR.T
    SCOTT
    SQL_TEXT
    USERNAME
    select sa.sql_text,ss.username from v$session ss, v$sqlarea sa where sa.hash_val
    ue = ss.prev_hash_value
    SYSregards
    Taj
    Message was edited by:
    Mohammad Taj

  • Error while saving the records in the database

    Hi,
    I am running into a wierd error.
    I have built a new page which contains the information about the employees. Some of the fields are updatable fields. The page shows the details of the person who logs into the page.
    I am not using EO in this page. The data is queried from the database from VO and displayed in the page and when the records are updated, they are saved in the databased using pl/sql procedure which is
    being called from AM. So i am basically not using VO to save the records in the database.
    The error which i am getting is,
    If 2 users are trying to update the page at the same time, user A's details are updated in user B's page.
    This is really causing the issue. Any help is greatly appreciated.
    Thanks in advance.
    PK

    I have posted the code used along with the dialog page. Please review.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Pavan, Start1",OAFwkConstants.STATEMENT);
    if (pageContext.getParameter("XYZBack")!=null)
    pageContext.setForwardURL("OA.jsp?OAFunc=OAHOMEPAGE"// OAWebBeanConstants.RETURN_TO_MENU_URL also tryed this , same error
    ,null
    ,OAWebBeanConstants.KEEP_MENU_CONTEXT
    ,null //not needed as we are retaining menu context
    ,null // no parameters are needed,true //retain AM,OAWebBeanConstants.ADD_BREAD_CRUMB_YES
    ,true
    ,null
    ,OAWebBeanConstants.IGNORE_MESSAGES);
    if(pageContext.getParameter("XYZUpdate") !=null)//The fields and their values are loaded as soon as the update button is clicked. We do this before calling the oadialog page so that the values are not lost
    OAViewObject EmpDetailsVO3 = (OAViewObject)OAAppl.findViewObject("XYZPersInfoVO");
    OARow EmpDetailsRow3 = (OARow)EmpDetailsVO3.first(); //Bringing the control over to the first row which is nothing but the displayed row.
    if(EmpDetailsRow3 !=null)
    s_workphone = EmpDetailsRow3.getAttribute("WorkPhone").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workphone is: "+s_workphone,OAFwkConstants.STATEMENT);
    s_fax = EmpDetailsRow3.getAttribute("WorkFax").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Fax is: "+s_fax,OAFwkConstants.STATEMENT);
    s_building = EmpDetailsRow3.getAttribute("Building").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Building is: "+s_building,OAFwkConstants.STATEMENT);
    s_room = EmpDetailsRow3.getAttribute("Room").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Room is: "+s_room,OAFwkConstants.STATEMENT);
    s_box = EmpDetailsRow3.getAttribute("Box").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Box is: "+s_box,OAFwkConstants.STATEMENT);
    s_preferedname = EmpDetailsRow3.getAttribute("KnownAs").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Preferred name is: "+s_preferedname,OAFwkConstants.STATEMENT);
    OAException OAExcep1 = new OAException("PER","XYZ_UPDATE_DETAILS");
    OAException OAExcep2 = new OAException("PER","XYZ_UPDATE_MESSAGE");
    OADialogPage OADialogPG1 = new OADialogPage(OAException.WARNING,OAExcep1,OAExcep2,
    OADialogPG1.setOkButtonToPost(true);
    OADialogPG1.setNoButtonToPost(true);
    OADialogPG1.setOkButtonLabel("Yes");
    OADialogPG1.setNoButtonLabel("No");
    OADialogPG1.setOkButtonItemName("DoOk");
    OADialogPG1.setNoButtonItemName("DoNo");
    OADialogPG1.setPostToCallingPage(true);
    pageContext.releaseRootApplicationModule();
    pageContext.redirectToDialogPage(OADialogPG1);
    else if(pageContext.getParameter("DoOk") != null)
    OAApplicationModule EmpDetailsAM = pageContext.getApplicationModule(webBean);
    Class[] paramtypes = {String.class, String.class, String.class, String.class,String.class,String.class,String.class};
    Serializable[] params = {s_personid,s_workphone,s_fax,s_building,s_room,s_box,s_preferedname};
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"personid is :"+s_personid,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workphone is :"+s_workphone,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workfax is :"+s_fax,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"building is :"+s_building,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"room is :"+s_room,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"preferredname is :"+s_preferedname,OAFwkConstants.STATEMENT);
    pageContext.releaseRootApplicationModule();
    OAAppl.invokeMethod("TransactionCommit",params,paramtypes);
    OAAppl.invokeMethod("initDetails");
    throw new OAException("The Building and Phone Information have been saved successfully"
    ,OAException.INFORMATION);
    thank you

  • Store SQL Query in Oracle database

    Hello,
    I am storing SQL query in database. here is an example of query.
    INSERT INTO TABLE_1 Values (' " + getValue1() + " ', ' " + getValue2() + " ' )
    getValue1() and getValue2() are functions to retrieve values.
    When I read query from the database and execute it, it doesn't read values from function.
    After I read query from database I would expect it to be
    INSERT INTO TABLE_1 Values ('value1', ' value2' ) but it is not reading values and trying to execute whatever I got from database.
    Any help?
    Thanks

    Thanks for your reply. Let me give you more info.
    All I am trying to do is storing queries in oracle
    database to use it in future for reporting. As I am
    doing reporting where clause will be different every
    time. Reporting involves queries not updates. But in any case that means that you would use a java SQL string that is useable via a prepared statement. As such your statement would look like....
    INSERT INTO TABLE_1 Values (?,?)
    Is it not possible to substitute variable string I
    got from database?What do you mean?
    SQL is SQL. You construct SQL so it is valid and runs. Can you construct SQL so it runs a function/select and uses that value in some more SQL - depends on the database, but usually.
    But that has nothing to do with java - it is SQL.
    Query contains variables that I have in Java code .Then it is SQL. It is java. You use bind variables (see PreparedStatement) and assign values to it.
    The SQL for such a query would look like the following...
    select field1, field2 from table1 where id=?
    In your java you would then use something like PreparedStatement.setInt(1, 100), to fill in the value for the '?' in the above.
    You might also note that your solution will not work for any arbritrary SQL statement unless you are also storing meta data about the SQL itself. For instance the following SQL statements would return the same result set but your java code would have to populate the bind variables different for both...
    select field1, field2 from table1 where id=? and name=?
    select field1, field2 from table1 where name=? and id=?

  • Where is the database connection for a mobile site?

    I have a Flash mobile site that I didn't create, but need to edit. On clicking the submit button it checks that the login & password are in a SQL database. The problem is, I can't find the method that runs a query on the database or where the database is even connected. I've tried searching through the code for words like "SQL", "database", and "connection" without success. I stepped through the code where I find a call to method "super", but then it goes back to the original method and then the user is logged in. Can someone explain where the call to the database is?
    Other things I'd like to know are: Where is the SQL Connection? In the main (non-mobile site), there is a web.config with a line that says
    <add name="TPConnectionString1"  connectionString="DataSource=xxx.xx.xxx.xx,xxxx\sqlexpress;Initial Catalog=TP;Persist Security  Info=True;User ID=xxxxx" providerName="System.Data.SqlClient"/>
    Where (what file: ex. web.config, xyz.as, etc.) would a similar line in the mobile code be?
    What does super(type, bubbles, cancelable) do?
    Here's the method for the submit button: LoginView.mxml
            private function btnclicked():void{  techController.username = txtUsername.text;  techController.password = txtPassword.text;  var evt:TechEvent = new TechEvent(TechEvent.LOGIN_USER);  this.dispatchEvent(evt);  }
    Here's the TechEvent function that is called: TechEvent.as
        public function TechEvent(type: String, bubbles:Boolean=true, cancelable:Boolean=false)  {  super(type, bubbles, cancelable);  }
    Here's the dispatchEvent method: UIComponent.as
    override public function dispatchEvent(event:Event):Boolean  {  if (dispatchEventHook != null)  dispatchEventHook(event, this);    return super.dispatchEvent(event);  }

    You are looking for an event handler for the TechEvent.LOGIN_USER event.
    Coding style looks similar to a SWIZ style framework, in which case, the event handlers could be defined using metadata [EventHandler] or [Mediate] tags, but could just be a plain simple .addEventListener(TectEvent.LOGIN_USER,fn); declaration earlier on.
    Either way, this is what has happened:
    1. User enters uname and password, then clicks button
    2. Button click handler populates the techController with relevant values then dispatches an event to let the world know it has done so
    3. The event handler checks the techController and makes the login call
    4. Some time later, the server will respond and trigger another event that the app can respond to
    G

  • Changing the Database driver causing performance issue

    Hello Experts
    I am finding a strange issue where if I change the database to Oracle 11g ( you will find it if you click the database which you have created in physical layer) under Data Source definition the report takes a longer time to complete.
    Actually I have upgraded the 10g rpd and catlog to 11g but database under data source definition was still using - oracle 10gR1 ( i donno whether this is a driver or not) . Everthing was running perfectly fine until I change the database under data source definition to Oracle 11g , the report takes a longer time . Also I found that the query is changed when I changed the database under data source definition to 11g.
    Also to inform you that datawarehouse is Database 11g where the data lies.
    what is the significance of Data source definition as changing it is changing the whole query.
    Pls. help.

    Hello,
    Do you have the Full Oracle 11g DB Client installed on the same box where you are running your BI Server .? Also can you make sure you have copy of tnsnames.ora in following directories.
    1. C:\Middleware\Oracle_BI1 \network\admin directory
    2. C:\Middleware\oracle_common\network\admin
    Check if the SQL Features that the datasource has , sometimes when you disable SQL features the server could issue a less effcient query to the database.
    Thanks,
    -SVS

Maybe you are looking for

  • Problem with Reader 9

    I have Adobe Reader 5 installed on my computer. I just installed the version 9.1. However, I cannot have it available to read from website. It seems the version 5 is still playing because the system reports that I need version 8 or 9 to read the webp

  • JSF: Problem with checkboxes using Tomcat

    Hello, I m using Java Sun Creator and I�ve noticed a very strange behavior of checkboxes while running my project with Tomcat (I tried 5.5 and 6.0). On my JSP I have a tabSet component with 3 tabs. the second tab (the first tab in order is selected p

  • CRM  Service quality reports

    Hi Forum, I m in need of a quality report from the CRM service module, I have heard that we can get quality reports from the same. Can anyone please indicate whether there are any standard quality reports that can be seen from CRM service implementat

  • Two Reports

    I want to generate two reports from one execution. One has to be default html and the other needs to be text (the text is basically for the reprots to be automatically picked up an analysis utility/tool. I am fowlloing an approach where I doubled the

  • TS1347 Recurring Calendar Meetings by Day

    I just received and iPhone 4S for Christmas. I need to set up a recurring event by the day not date. Example YCHS Meeting the first Thursday of each month.