Displaying the SQL used in a report

I have produced a page with a number of report regions based on SQL SELECT statements.
Is there an easy way of showing those SQL statements to the people authorised to view the page, e.g. via using an in-built API or function call ?
I am using v2.0.
Thanks.

Hello, thanks for the suggestion, which was very elegant, I thought.
However, I cannot get it to work in either v2.0 or 3.1.
In the latter, I carried out the following steps:
<ol><li>Define a hidden variable called P_SQL with the Static assignment of the query (I just tried 'select sysdate from dual', without the quotes shown here.)</li>
<li>Created a new region of type SQL Query (PL/SQL function body returning SQL query), the source of which is 'return :P_SQL;'</li>
</ol>
The page however then displays the following error:
failed to parse SQL query:
The query can not be parsed, the cursor is not yet open or a function returning a SQL query returned without a value.
If I put quotes around the statement, i.e. return ':P_SQL'; then I get a slightly different error:
failed to parse SQL query:
ORA-00900: invalid SQL statement
If I instead surround the :P_SQL with q'!...!' , I get the same error.
Thanks in advance for any more help.

Similar Messages

  • Report To Show SQL Used In A Report

    I am creating a set of quality reports using the apex views.
    I would like to create a report to check the sql used in classic reports, but can't seem to find the right view to use.
    If it was a interactive report I would use the SQL_QUERY column in the APEX_APPLICATION_PAGE_IR view, but this does not seem to exist for classic reports
    Help appreciated.
    Gus

    Gus C wrote:
    I am creating a set of quality reports using the apex views.
    I would like to create a report to check the sql used in classic reports, but can't seem to find the right view to use.
    If it was a interactive report I would use the SQL_QUERY column in the APEX_APPLICATION_PAGE_IR view, but this does not seem to exist for classic reports
    You can use the Data dictionary view APEX_APPLICATION_PAGE_REGIONS. There's a field called "REGION_SOURCE" - just filter for the appropriate region type.
    Help appreciated.Really? What about Re: Validate Date and Time? If you want to show genuine appreciation for help given, why not award "correct/helpful" points to posts which helped you solve your problem, as per the forum introduction post:
    >
    * It is considered good etiquette to reward answers with points (as "helpful" - 5 pts - or "correct" - 10pts).
    >
    Having a brief look through your list of recently answered questions, you don't seem to award helpful points, even when you've explicitly saying (paraphrasing) "Thanks for your help". Maybe it's a tipping thing - perhaps you subscribe to the doctrine of Mr. Pink but, hey if it helps you get your question answered and it literally costs you nothing but a few seconds of effort, why not throw us a bone by awarding a point now and then?

  • Displaying the SQL Query in the report

    How can i display the query used to display a report..
    My query to get the records is as below
    select ename,empno from emp
    where deptno = :p_dept
    When i run the report i want to display the select statement as a message....
    How can we do this?

    One way is to create a column formula which you specifically redefine your query in. However, if you change your query you will need to also change your column formula. So this way could be prone to a mismatch of data. Unfortunately, I don't know of any better way. Hopefully someone else can suggest a better method. Good luck.

  • How do you display the SQL that BEx uses?

    All,
    I would like to display the SQL that is submitted to BEx.  I understand you can perform a SQL Trace (ST05), but I want to see the SQL before is submitted to BEx.  Can anyone help me.
    Thanks.

    As Allison mentions - use RSRT, choosing Execute + Debug.
    From there you will see an option, Display SQL Query, which may be what you want, it displays the SAP's Open SQL, but what you might relate better to is the Display  Run Schedule, which will show the SQl as translated to the target DB environment and the Explain (execution) Plan.
    Just as an FYI, ST04 is also useful for seeing the SQL and execution plans of a query that has already run. Check it out if you are not familiar with it.

  • What r the tables used for this report.

    hi all..
    i am a fresher for ABAP. i need the help.
    what r the tables used for this report.
    Reports provide pending order details according to Material wise and customer wise for particular month.
    thanks in advance
    RK.Ashokkumar.

    Hi Ashok,
    this is easy to do.
    Open Two SAP Screen with same user ID.
    Run SQL trace using ST05 transaction.Open ST05 transaction in One and make
    Trace on ,Run the report in another screen.
    Once report run is over.End the trace process and click on display trace in same ST05 transaction.There is a click button on ST05 Transaction screen to start trace
    process,End trace process and Display track process.
    The SQL trace will  give you all the table details which is used in that particular report.
    You have not mentioned about the report name so I have suggested this way.
    regards,nishant
    Please reward if this helps

  • How can i display the presentation variable in my reports

    Was facing a problem to display the Presentation variable on my report, however i managed to display it on answers, but when i try to display it on my Publisher report it doesnt shows any data.
    I use to Select the Values From my prompt, and it shows the Reflection of Presentation Variable on my Answers Report. but i cannot see the Reflection of data on my Publisher Report Please any One Can help me with this.

    Removing '' does not work it given the following error
    "State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <@>: Syntax error [nQSError: 26012] . (HY000)"
    and by adding space you mean that I use it as '@{ BbranchCode}'?
    What I am doing at the moment is
    1. Write the given query in oracle BI Answers.
    2. Made a dashboard prompt in Answers.
    3. Made a report in dashboard using the Answers report and the dashboard prompt.
    Up till this step it works perfectly fine and the data displayed in manipulated on the basis of the values selected in the prompt.
    4. Now what I want is to display this report in Dashboards using oracle BI publisher. For that I use the template builder provided for microsoft word.
    5. I login to that add-on, open the answers report where I can see the field in the rowset. I select that field and save the template.
    6. I open the oracle BI publisher and make a new reprt with data model of the answer's report and Layout of the one I just created.
    7. I open the dashboard and put in the BI publisher report in the same page in which the asnwers report and the prompt was.
    8. Upon changing the values of the prompt the report in the answers is still getting manipulated but I am not able to see its reflection of the BI publisher report.
    The thing is that I am currently using this presentation variable to manipulate my reports in dashbords using dashboard prompts. The report is built in oracle BI Answers and it is working perfectly fine with it. Now when I use the template builder for Microsoft Word and open the template with the answers's report of this query I see the field in the row set but when I display the template in the dason the bases of this presentation variable the report in the oracle BI Answers is getting updated when I change values but when I use the template builder for microsoft word the the field is being shown in the row set.

  • What r all the tables used for this report. please reply

    hai,
    what r all the tables used for this report.
    report :
    <b>
    •     Report to display all finished goods that go out-of-stock. Developed a drill down report for materials details (totals and subtotals for material stock values by material group and material type).</b>
    thanks in advance

    hi Ashok,
    Check this out
    http://www.allsaplinks.com/tables.html
    http://www.sapgenie.com/abap/tables.htm
    Regards,
    Santosh

  • Automated Solution for Exporting SQL used in Crystal Reports

    My company has created over 400 reports that are running on Crystal Reports XI. Due to proposed changes in our database, we occasionally need to review the SQL statements of all 400+ reports to determine if any of them would be impacted by the proposed changes. In order to review the SQL used in these 400+ reports, we have had to open each report manually. We would like to know how we can review the SQL used in the reports without having to manually look at each report. I suspect there is a way to either write a program or use a tool that will export the SQL that is used in all reports. In a similar vain, we would be interested in knowing if there is an automated way to identify table names and fields that are used in each SQL statement.

    I see two directions to go:
    1. Review functionalities of .rpt Inspector
    [http://www.softwareforces.com/Product/ri/pro/3/rptInspector.htm]
    - it allows rpt mass analyses
    2. Post your question to ".Net Development - Crystal Reports" forum to see if it is possible to access required information through custom application

  • Get an set the SQL statement from a report at runtime

    i know there is an opportunity to filter the records by using setRecordSelectionFormula() method...but i wondered if you can anyhow get the whole SQL statement that is in the report. i think it would be very useful for many developers to maipulate the SQL directly like you were able to using the PE-functions in the old CRPE32.DLL...
    but in CR XI the CRPE32.DLL is no longer supported. now we have to substitute these functions with the JRC but i am not sure if it provides everything we had in the CRPE32.DLL...
    after all i do not understand why the CRPE32.DLL is still delivered but not supported. in my CR XI R2 installtion i found this file signed with version 11.5.3.438
    by the way it is a question of performance...a query would be faster if you could directly query the database by changing the reports sql statement instead of allowing the report to retrieve all data and then performing the filtering.
    so please, for the next version of the JRC give us the opportunity to get an set the sql statement of a report directly!

    Not an option. crpe32 is proprietory and the SQL we generate is to complex to assume it will be done correctly. Which is why the ability was removed

  • What are all the tables used for this report:

    hi
    what are all the tables used for this report:
    report:
    •     <b>Stock Report, which will give opening balance, receipt, issue, and closing balance for any given Duration for any material.</b>
    thanks in advance

    Tables: MSEG, MKPF, MARD.
    FOR REFERENCE SEE TRANSACTION : MB5B.
    Message was edited by: Sharath kumar R

  • What are the tables used for this Report

    hi all..
    i am a fresher for ABAP. i need the help.
    what r the tables used for this report.
    Reports provide pending order details according to Material wise and customer wise for particular month.
    thanks in advance
    RK.Ashokkumar.
    9994262112.

    hi
    good
    try with these tables,
    MARA
    KNA1
    thanks
    mrutyun^

  • How to see the SQL used in an existing Rule file?

    Hi,
    Is there a way to see the SQL used in the rule file defn of any existing rule file which retrieves data from a RDMS?
    Appreciate your thoughts.
    Thanks.

    Sure.
    In EAS open up the load rule in question, then select the menu item "File"-"Open SQL".
    Robert

  • Display the sql statement with arguments with ojdbc14_g.jar

    Hi,
    I'd like to display the sql statements with ojdbc14_g.jar.
    So I've followed the documentation and set an OracleLog.properties file which is linked to my java program.
    The problem is the trace generated is huge and I only need the SQL requests wich are made with the arguments but I don't know how to configure that.
    Have you got a sample file which handle that ?
    I've tried that :
    oracle.jdbc.handlers=java.util.logging.ConsoleHandler
    java.util.logging.ConsoleHandler.level=CONFIG
    java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
    oracle.level=INFO
    oracle.jdbc.driver.level=OFF
    oracle.jdbc.driver.OraclePreparedStatement.level=OFF
    oracle.jdbc.pool.level=OFF
    oracle.jdbc.util.level=OFF
    oracle.sql.level=INFO
    But that doesn't display only the SQL and args :(
    Regards.

    The fact is the statement are made by ejb entities on JBoss so I don't have a way to make specific logger to display the sql order. The only thing I can do is to set the log4j org.jboss.ejb.plugins.cmp to a trace level in order to see the sql order but without the arguments.
    I tried those traces however I see stuff like that without any SQL orders :
    <<
    10:10:53,833 INFO [STDOUT] NFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:52 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:52 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:52 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:52 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:52 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=VIEW_ACTION_NAMES)
    29 nov. 2007 10:10:52 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:52 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:52 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getCatalog
    INFO: PhysicalConnection.getCatalog()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=PROCESS_TYPE_HIERARCHY)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getCatalog
    INFO: PhysicalConnection.getCatalog()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=PROCESS_TYPE_HIERARCHY)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getCatalog
    INFO: PhysicalConnection.getCatalog()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=FORM_EMBEDDED_VIEWS)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getCatalog
    INFO: PhysicalConnection.getCatalog()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRemarksReporting
    INFO: PhysicalConnection.getRemarksReporting()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
    INFO: PhysicalConnection.getDefaultFixedString() returning false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=1, x=%)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OraclePreparedStatement setString
    INFO: OraclePreparedStatement.setString(paramIndex=2, x=FORM_EMBEDDED_VIEWS)
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getRestrictGetTables
    INFO: PhysicalConnection.getRestrictGetTables() returned false
    29 nov. 2007 10:10:53 oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
    GRAVE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 4000
    29 nov. 2007 10:10:53 oracle.jdbc.driver.OracleResultSetImpl close
    INFO: OracleResultSetImpl.close()
    29 nov. 2007 10:10:53 oracle.jdbc.driver.PhysicalConnection getMetaData
    INFO: PhysicalConnection.getMetaData()
    29 nov. 20>>

  • Where to find the SQL log by crystal reports

    i want to watch the sql log by crystal report loading,but i don't know how to find it , somebody knows it? thanks advanced!

    Hi Wang,
    If you mean to look at the SQL query CR generates, then open the report in the CR Designer > Go to the Database option on the top > Click Show SQL.
    -Abhilash

  • How to get the SQL Statement of a report region?

    For example: The SQL of report region such as "SELECT A,B,C FROM T1 WHERE A = :P10_A".
    I hope to get the converted statement (the variable has been replaced), like this:
    :P10_A = 'TOM', SQL: "SELECT A,B,C FROM T1 WHERE A = 'TOM'".
    THX.

    I agree with John with the usual caveat about using bind variables.
    In other words, you should use
    SELECT A,B,C FROM T1 WHERE A = :P10_Ainstead of SELECT A,B,C FROM T1 WHERE A = 'foo'so that the shared pool doesn't get clutterred with copies of the same (sharable) SQL.
    Even if you use the "PL/SQL function returning a SQL query", be sure to use bind variables in your SQL and not "glue in" session state by concatenating it into the query.
    Thanks.

Maybe you are looking for