The actual query being executed

hi all,
is there a way to log the actual sql query being executed
i saw that there is trace option for sql query
but it is not logging anything
can anybody help me please
regards,
ramakrishna

The easiest way to do this that I've found is to determine which session is running the report. This is difficult if it is interactive as the reports runtime engine starts a session when you run it. Then just issue a sql trace with binds from another session (dbms_support package or dbms_ev)
I'll sometimes put an entry using dbms_application_info (suggested on asktom) in a beforepform trigger so I know which session is the one with the report - in caseI have multiple logons under one account.

Similar Messages

  • How to get the Actual Query of View Object

    Hi all,
    I have a standard. I need to modify the query of the VO attached to a picklist based on responsibility. I am able to achieve my requirement but it is getting reflected for all the responsibilities even though i extended the controller for a particular responsibility. I used setQuery() to change the query of my VO. When checking "About this page". The code i added also shown in the page. Now i want to get the actual query to the VO before the controller is extended so that i can set the modified query or actual query based on my responsibility. Kindly share your knowledge.
    Regards,
    Pradeep

    Hi,
    I guess following query will not work ,Why use 2 where clauses.
    SELECT * FROM (select NVL(VENUE_NAME,' ') "Venue",
    NVL(VENUE_CITY,' ') "City",
    NVL(COUNTRY_DESC,' ') "Country",
    EVENT_NUMBER
    From NS_EVENT_VENUE_DETAILS,NS_COUNTRY_MASTER WHERE COUNTRY_CODE = VENUE_COUNTRY) QRSLT WHERE (QRSLT.EVENT_NUMBER = 1539
    you can as following using bind variable.
    http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcquerying.htm#CEGDGIJH

  • Is there a way get the actual query that was excecuted

    I have a large query with lots of <cfqueryparam 's
    Is there a way get the actual query that was excecuted so I can debug it/ find out what the problem is, no sql error just logic error

    Personally, I think the easiest way is to use the powerhouse combo of Firebug and ColdFire. (Sorry if you already know this) Firebug is a plugin for Firefox for debugging (great JavaScript debugger in it!). ColdFire is a ColdFusion debugger that hooks into Firebug.
    Firebug: https://addons.mozilla.org/en-US/firefox/addon/1843
    ColdFire: http://coldfire.riaforge.org/
    There are a couple of steps to installing ColdFire on your server (in addition to the Firefox plugin) but it's just a matter of copying a CFM file into a particular folder on your server's CF install. Then you just select ColdFire as the debugging output option in the CF Administrator and you're good to go (the ColdFire zip archive has an install doc).
    Once you're using it, ColdFire lets you see all your queries: the actual SQL, the execution time, whether or not it's cached, etc.
    While there are other techniques for seeing your SQL, I've always found ColdFire to be the easiest to use.

  • Finding the WMS Rule being executed currently

    Hi All,
    Is there any feature to find the WMS Rule (Put Away or Pick) being executed at that particular instant?
    The requirement is to populate the Rule Name into Custom table incase of exceptions occured in the custom object used in the expressions.
    Thanks in advance.
    Regards,
    Shabbeer

    Hi,
    Use Autonomous transaction within the custom object using a function and insert into custom table along with the rule name and other required details including exception details. Hope this helps.
    Regards,
    Sravan.

  • System Query being executed millions of times

    Hello -
    Below is from an AWR report (for a 24 hour duration):
    CPU Elapsed CPU per % Total
    Time (s) Time (s) Executions Exec (s) DB Time SQL Id
    3,686 3,962 10,593,197 0.00 1.5 0h6b2sajwb74n
    select privilege#,level from sysauth$ connect by grantee#=prior privilege# and p
    rivilege#>0 start with grantee#=:1 and privilege#>0
    Has anyone seen this being called from within their AWR/statspack reports? The app tier is Websphere, and I am not seeing this called in any of my databases that use WebLogic on the app tier.
    Thanks in advance for any insight!
    Mike

    Most probably your schema security is based on direct privileges assignment rather than roles.
    This only means your users are being validated if they have enough privileges to perform a task against an object. If sys queries are able to be seen from awr, this could mean one out of two things:
    1. Your database is over administrated
    2. You don't have meaningful user's activity.
    ~ Madrid

  • Database migration query not executing in database

    We moved over our SQL database to another server. We have a few .cfm template files that have queries to get 'content' from our database. These queries in the .cfm template files work fine and execute properly. However, for some reason, since we moved over our database, the queries in the actual database don't execute/run anymore. In the old server we didn't have this problem. Our queries in the database would run properly then. The data would display correctly on the webpages.
    Is there some kind of properties setup that was overlooked when migrating over our database?
    The output we now see when viewing our pages is the actual query code.
    Example:
    SELECT lname
    FROM table
    This is actually displayed on the website and therefore the query is not executing/running. Our code was never changed. So why is it not outputting the same?
    Thanks for any help provided.

    Sorry for the confusion.
    The coldfusion templates and database queries both worked fine on the previous old server.
    Now since the migration onto the new server, only the coldfusion templates work fine, but not the queries in the database.
    So for example, a query in the coldfusion template will run fine, and execute the intial pull of data. But once the content is pulled from the database, the queries inside the database (including stored procedures) don't execute.
    We do get the expected results when we run our stored procedure in Management Studio and if we put the stored procedure on a standalone web page we do see the records. 
    We only see the sql code when we have the stored procedure inside of our w_content table of our database, and its being called by the first query in the template.  For some odd reason the stored procedure does not execute if it is inside the database.  
    Hopefully that clarifies our problem.
    Thank you for helping!

  • Sequence.nextval doubles the returned value with Execute Statement (F9)

    There appears to be a quirk with sequences in Raptor.
    Has anyone noticed that depending on how you execute this sql (SELECT MYSEQ.NEXTVAL FROM DUAL;) the value returned is either the correct nextval or double what you expected?
    For example, MYSEQ is a simple sequence which increments by 1. If you Execute Statement (F9) then the value returned jumps by 2 instead of 1. If you Run Script (F5) then the value returns jumps by 1, as expected.
    If MYSEQ is changed to increment by 2. The when you Execute Statement (F9) then the value returned jumps by 4 instead of 2. If you Run Script (F5) then the value returns jumps by 2, as expected. No matter what you put for the increment by Execute Statement (F9) always doubles it.
    It always seems to be double. Executing the same scenario in TOAD always returns the correct value (i.e. properly increments).
    Is the query being executed multiple times with Execute Statement? Why is this happening?

    While there is no guarantee from Oracle that sequences produce sequential numbers, this is obviously a case where SQL Developer is running the select statement twice.
    The issue is that queries can actually change information, rather than just retrieve data from the database.
    The following package is a test case:
    create or replace package test_query is
    function get_next_count return number;
    end;
    create or replace package body test_query is
    cnt number := 0;
    function get_next_count return number is
    begin
    cnt := cnt + 1;
    return cnt;
    end;
    end;
    select test_query.get_next_count from dual;
    This query, which should return 1, 2, 3, 4, etc actually returns 2, 4, 6, 8, etc, because SQL Developer is running the select twice.

  • How to get all parameter names along with their values in stored procedure which is being executed

    Im using sql server 2012, is there any possible way to get all the parameters of a stored procedure along with the values passed to it.
    I need these things to build a xml. I mean this should happen in the procedure which being executed and it should be common for all the procedures.
    For example, let us suppose we have to procedures,
    uspSave, @name='test' @age=20
    uspDelete @id=2
    now in uspSave procedure, i need to get @name, @age and the values 'test', 20 and in uspDelete, i should get @id with value 2.
    For getting the column names, i tried this,
    select parameter_name from information_schema.PARAMETERS where specific_name=OBJECT_NAME(@@procid)
    now is it possible to loop through the result of above query and can we get the values.

    I think  you need running SQL Server Profiler to capture this info even in SQL Server 2012.
    Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
    Blog : MS SQL Development and Optimization
    Blog : Large
    scale of database and cleansing

  • Call to java bean but code not being executed.

    Making a call to my javabean class called ch06_03.java from a jsp program shown below:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Using a java package.</title>
    </head>
    <body>
    <% beans.ch06_03 messager = new beans.ch06_03(); %>
    The message is: <%= messager.msg() %>
    </body>
    </html>
    The call from jsp to javabean program is only returning the hello from java and NOT EXECUTING ANY OF THE CODE in the msg() method. I am checking my table landings_hold and nothing is there, my log file shows nothing. Why is the code not being executed except for the return statement?
    My javabean program is shown below:
    package beans;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    public class ch06_03 {
    StringTokenizer st1;
              String val1, val3, val4, val5, val9, val10, val11, val12, val13, val14, val16;
              String val2, val6, val7, val8, val15, val17, val18, val19, val20;
              int cnt;
              String filetext = "Starting RIFIS Upload";
              java.util.Date d = new java.util.Date();
              SimpleDateFormat form = new SimpleDateFormat("dd/MMM/yyyy hh:mm:ss");
              String dateString = form.format(d);
    public String msg() throws Exception {
         try {
         Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@xxxxx.xxxx.xxx:1521:xx","xxxxxx","xxxx");
              Statement st = conn.createStatement();
         File f = new File("C://upload");
              FileWriter outFile = new FileWriter("C://RIFIS/log/logfile.txt", true);
              outFile.write(System.getProperty("line.separator"));
              outFile.write(filetext+" - "+dateString);
              if (f.isDirectory())
              { String [] s = f.list();
              for (int i=0; i<s.length; i++)
              { outFile.write(System.getProperty("line.separator"));
                   outFile.write("Found file - "+f+"/"+s);
              FileReader file = new FileReader(f+"/"+s[i]);
                   File inputFile = new File(f+"/"+s[i]);
                        File outputFile = new File("C://RIFIS/archive/"+s[i]);
                   BufferedReader buff = new BufferedReader(file);
                   boolean eof = false;
                   String val0="";
                   ResultSet rec = st.executeQuery("SELECT landings_hold_batch_seq.nextval FROM dual");
                        while(rec.next())
                        { val0 = rec.getString(1); }
                        cnt=0;
                        while (!eof)
                        { String line = buff.readLine();
                        if (line == null)
                        { eof = true; }
                             else
                             { cnt = cnt+1;
                                  st1 = new StringTokenizer(line,",");
                                  val1 = st1.nextToken();
                                  val2 = st1.nextToken();
                                  val3 = st1.nextToken();
                                  val4 = st1.nextToken();
                                  val5 = st1.nextToken();
                                  val6 = st1.nextToken();
                                  val7 = st1.nextToken();
                                  val8 = st1.nextToken();
                                  val9 = st1.nextToken();
                                  val10 = st1.nextToken();
                                  val11 = st1.nextToken();
                                  val12 = st1.nextToken();
                                  val13 = st1.nextToken();
                                  val14 = st1.nextToken();
                                  val15 = st1.nextToken();
                                  val16 = st1.nextToken();
                                  val17 = st1.nextToken();
                                  val18 = st1.nextToken();
                                  val19 = st1.nextToken();
                                  val20 = st1.nextToken();
                                  st.executeUpdate("INSERT INTO LANDINGS_HOLD (lh_id, lh_batch, supplier_dr_id, supplier_unique_id, supplier_dealer_id, supplier_cf_id, supplier_vessel_id, unload_year, unload_month, unload_day, state_code, county_code, port_code, itis_code, market, grade, reported_quantity, unit_measure, dollars, lh_loaddt, lh_loadlive, purch_year, purch_month, purch_day)" +
                        "VALUES (0,'"+val0+"','"+val1+"',"+val2+",'"+val3+"','"+val4+"','"+val5+"',"+val6+","+val7+","+val8+",'"+val9+"','"+val10+"','"+val11+"','"+val12+"','"+val13+"','"+val14+"',"+val15+",'"+val16+"',"+val17+",SYSDATE,NULL,"+val18+","+val19+","+val20+")");
                             } // while else end
                        } // parent while end
                        FileReader in = new FileReader(inputFile);
                        FileWriter out = new FileWriter(outputFile);
    int c;
                        while ((c = in.read()) != -1)
                        { out.write((char)c); }
                        in.close();
                        out.close();
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Number of records inserted - "+cnt);
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Copied upload file to archive directory");
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write(f+"/"+s[i]+" - Has been removed from upload directory");
                        buff.close();
                        inputFile.delete();
                   } // for end
                   outFile.write(System.getProperty("line.separator"));
                   outFile.write("Upload Complete...NO ERRORS");
                   outFile.write(System.getProperty("line.separator"));
                   outFile.write("*************************************************************");
                   outFile.write(System.getProperty("line.separator"));
                   conn.close();
              } // if end
              else
              { outFile.write("No files to process"); }
              outFile.flush();
              outFile.close();
              } // try end.
              catch(Exception e)
              { FileWriter errFile = new FileWriter("C://RIFIS/log/errfile.txt", true);
              errFile.write(System.getProperty("line.separator"));
              errFile.write("ALERT....ALERT....ALERT");
              errFile.write(System.getProperty("line.separator"));
              errFile.write("Error Occurred in ReadSource.java - RIFIS Upload");
              errFile.write(System.getProperty("line.separator"));
              errFile.write("My Error: " + e);
              errFile.write(System.getProperty("line.separator"));
              errFile.write("*************************************************************");
                   errFile.flush();
                   errFile.close();
              } // catch exception end.
         return "Hello from java";
         } //public msg block
         public ch06_03()

    Since you didn't use code-formatting tags ([ code ] and [ /code ] without the spaces) it's kinda hard to look at it. But I'm sure it DID execute much more than just the return statement - maybe you're not closing a file or db connection, or maybe you're seeing a cached page, so it actually isn't executing ANYTHING on the server (is your browser set to never check for newer pages so it (almost) always returns from cache, for example?)

  • Actual Query Plan not running

    I am using SQL Server 2012 (11.0.5058.0) and I am trying to learn Execution Plan Basics.  One of the tasks is to run the "Actual Query Plan" by CTRL+M.  When I try this nothing happens.  I can do the "Display Estimated
    Query Plan" and it works.  Why can't I do the Actual Query Plan?

    Hi,
    To display Actual Query Plan, you have to execute the query. CTRL+M merely toggles to display Actual Query Plan or not.
    See:
    Display an Actual Execution Plan
    Hope this helps,
    ~ J.

  • SubQuerry Not being executed

    Hi Gentelmen;
    I have posted this question in the Test and Playground Forum but no one has responded.
    Any of you experts in this forum may be able to help me please...
    I have this problem where I am selecting records to display on the report from table customer and trying to count how many booking are there for each customer in booking table based on the customer id from booking table.
    here is my query code below...
    select id name city custtype discount into (wa-scid, wa-scname, wa-sccity, wa-scctype, wa-scdisc) from customer
      where city = 'CityName' and
      country = 'CountryName' and exists (
      select count( distinct custid ) as wa-cnt from bookings group by custid ).
      WRITE: /1 wa-scid, 11 wa-scname, 40 wa-sccity, 70 wa-scctype, 78 wa-scdisc,'%', 90 wa-cnt.
      endselect.
    I have tried to debug the issue and seems like the sub query is not being executed. The reason i say that because the value  of wa-cnt which is a counter of type i is not changing.
    Any one can shed some light in this matter/problem please...
    Many Thanks.
    -hisheeraz

    You are using AS addition in the subquery to determine whether the subquery is being executed or not, and I think this is wrong. AS addition has only meaning when your using wither INTO or APPENDING, it wouldn't change the value of wa-cnt.
    I suggest you to try to change the subquery to
    and exists ( select count( * ) from bookings ).
    As you're using only the COUNT aggregation expression int the subquery, a GROUPING is not necessary.
    Regards

  • Where to find the resolved query sent to the database?

    Verison 4.1.1.00.23
    Hello,
    Where/How do I find the actual query that is sent to the database?  I've enabled Debug on the Dev Toolbar, but I still don't see where the query that is sent to the database is at? I'm hoping to see a view with the page items resolved not what is actually in the page.
    I have a query on a collection and I keep getting a 'SQL command not properly ended' error and I'm not seeing why it's not "properly ended".
    Hope this is clear.
    Let me know if not.
    Thanks,
    Joe

    Tony,
    Thank you for replying.
    There is an update -  The query no longer throws the 'SQL command not properly ended', but now it throws the dreaded 'Missing Right Parenthesis' error.
    The query is:
                APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B (p_collection_name => 'TEAM_EMP',
                                                                p_query => 'SELECT cme_system, tbs_team_id, resource_id,
                    CASE WHEN resource_type = ''C'' THEN ''Consultant'' ELSE ''Employee'' END AS resource_type, role,
                    jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, forecast_id, project_id,
                    jan_id, feb_id, mar_id, apr_id, may_id, jun_id, jul_id, aug_id, sep_id, oct_id, nov_id, dec_id,
                    resource_name, tbs_forecast_year.last_updated, last_updated_by.last_updated_by, area_id, p.group_id, team_name,start_date, end_date, p.project_name
                    FROM tbs_forecast_year
                    INNER JOIN (SELECT project_id pid, area_id, tbs_projects.group_id, UPPER(project_name) project_name
                                FROM tbs_projects
                                WHERE status IN (''Pipeline'', ''Planned - Partially Funded'', ''Planned'', ''Execution'')) p
                    ON p.pid = project_id
                    LEFT JOIN (SELECT resource_onepass_id, resource_name last_updated_by
                               FROM resources where resource_onepass_id is not null) last_updated_by
                    ON last_updated_by.resource_onepass_id = tbs_forecast_year.last_updated_by
                    LEFT JOIN tbs_teams ON tbs_teams.team_id = tbs_team_id
                    LEFT JOIN (SELECT resources.resource_id rid, resource_name from resources) resources
                    ON rid = resource_id
                    WHERE (jan > 0 OR feb > 0 OR mar > 0 OR apr > 0 OR may > 0 OR jun > 0 OR jul > 0 OR aug > 0 OR sep > 0 OR oct > 0 OR nov > 0 OR dec > 0)
                    AND forecast_type = ''Supply''
                    AND (project_id = '|| :F189_PROJECT_ID ||' OR 0 = '||:F189_PROJECT_ID ||')
                    AND (tbs_team_id IN (SELECT * FROM the(SELECT cast(vc2_list('|| :F189_TEAM_ID ||') as vc2_list_type) FROM dual))
                        OR 0 IN (SELECT * FROM the(SELECT cast(vc2_list('|| :F189_TEAM_ID ||') as vc2_list_type) FROM dual)))
                    AND (resource_id = '|| :F189_RESOURCE_ID ||' OR 0 = '||:F189_RESOURCE_ID ||')
                    AND (team_name like ''%'|| :F189_TEAM_NAME ||'%'' OR '' '' = '' '||:F189_TEAM_NAME ||''')
                    AND (area_id = '|| :F189_AREA_ID ||' OR 0 = '||:F189_AREA_ID ||')
                    AND NOT (0 = '||:F189_RESOURCE_ID ||' AND 0 = '||:F189_AREA_ID ||' AND 0 IN (SELECT * FROM the(SELECT cast(vc2_list('||:F189_TEAM_ID||') as vc2_list_type) from dual))
                    AND 0 = '||:F189_PROJECT_ID ||' AND '' '' like '' %'||:F189_TEAM_NAME ||'%'')
    Line 22 is calling a function to deal with a Multi-Select list that I found https://community.oracle.com/message/3566187#3566187. I've created the TYPE and the function as indicated in that thread. The error is thrown when multiple Team's are selected.
    The exact error is: create_collection_from_query_b Error:ORA-20104: create_collection_from_query ParseErr:ORA-00907: missing right parenthesis
    There are going to be 4 multi-select lists and TEAM_ID is the first.
    :F189_TEAM_ID is an application item that is being populated from a page process.
    If you have a better solution for dealing with Multi-Select lists I would be very interested in hearing it.
    I've tried the replace and the instr methods with no success. Once the Collection is working then I have to modify the query for the page which is using the APEX_ITEM API's, but I haven't gotten this working yet.
    Thanks Tony!
    Joe

  • Error from bex query while executing in portal

    Dear Experts,
    while executing the query bex analyzer, is working ok but the same query when executing in portal is throwing the following error:
    error message:
    The initial exception that caused the request to fail was:
    Termination message sent
    ABEND RS_EXCEPTION (000): The argument '0,01' cannot be interpreted as a number
      MSGV1: The argument '0,01' cannot be interpreted as a
      MSGV2: number
    Messages
    ABEND: The argument '0,01' cannot be interpreted as a number
    ABEND: An exception with the type CX_SY_CONVERSION_NO_NUMBER occurred, but was neither handled locally, nor declared in a RAISING
    ABEND: Program error in class SAPMSSY1 method : UNCAUGHT_EXCEPTION
    I tried to find from existing blogs but did not get suggestions for similar issue.
    Coud some be kind enought to analyse this error.
    Inputs will highly been appreciated
    Thanks in advance,

    Hi,
    Here I tried retransporting the depended bex queries accross the landscape.
    Now the reports are OK from the Portal.
    Thanks,
    Mannu

  • Bex query designer -- Execute Error

    Hello,
    when i am executing the Bex query designer -- > Execute. i am getting the following error.
    Service not attainable
    What has happened?
    The call of the URL http: // fe-pit-ttbw.company.com:8000 / irj/servlet/prt/portal/prtroot/pcd! 3aportal_content! 2fcom.sap.pct! 2fplatform_add_ons! 2fcom.sap.ip.bi! 2fiViews! 2fcom.sap.ip.bi.bex it was broken off, because the appropriate service is not available.
    Indication
    The demolition appeared on the system PIT and with the fault code 404 and the reason trouble(need) found. The selected virtual Host was 0.
    What can you do?
    Please, choose a valid URL. If you still dispose of no user's identification, you address your system administrator.
    Fehlercode:ICF-NF-http-c:000-u:SAPSYS-l:D-i:rb3pnk2_PIT_00-v:0-s:404-r:Notfound HTTP 404 - trouble(need) found your Internet SAP Communication Framework team
    Edited by: Ranga123 on Aug 5, 2010 1:14 PM

    hi
    have u checked if web service is active to open the report in web?
    use T-Code SICF
    also check if portal is up or not.
    also check below post:
    [SICF service - error code 404;
    Edited by: Gaurav on Aug 5, 2010 2:01 PM

  • If bindParametersForCollection fires will a query definitely execute?

    Hi
    I have an ADF BC application written in Jdev 10.1.3. The user is reporting performance problems in one part of the application. We have a CustomViewObjectImpl which overrides the bindParametersForCollection method and outputs the following message
    System.out.println("### Executed Query here for View Object "+getFullName());This message is output 3 times indicating the view object query is executed 3 times. I have accounted for 2 of them but I can't for the life of me see why the VO query is executing a third time.
    I wondered if this message is accurate in saying that the VO query is executing when the bindParametersForCollection is fired?
    I put a message in the view objects class file. In the executeQueryForCollection method is
      String calling = new Throwable().fillInStackTrace().getStackTrace()[1].getClassName();
      System.out.println("called by <"+calling+">");This only fires once - before the first "Executed Query here for View Object".
    thanks
    paul schweiger

    I found what was causing the third execute query - there was a reference to #{bindings.WsWanalItemsView1Iterator.estimatedRowCount} in one of the items on the page.
    Am I right to presume that estimatedRowCount causes the same performance hit executing the view object's query?

Maybe you are looking for