Get SQL for query to be displayed

Hi,
I'm creating a custom export tool (I've seen Denes's but I need to add some more customization to it). Is their a way I can get the SQL that is used to generate both "regular" reports and Interactive Reports (especially what the user is currently looking at). Generating the code for regular reports (including the sort order that the user is using) isn't too difficult. I've built a prototype for the Interactive Reports but it gets kind of messy and if any of the logic is changed in the next version of APEX I'll have to re-write.
Just to be clear I know I can get the default report SQL in the apex views. What I'd like is the query for what the user is currently looking at (i.e. conditional columns, sort order, and all the IR features).
Thank you,
Martin

Hi Martin,
The only way I see this working is looking into the different apex views (like you suggested), also for the Interactive Reports.
Following views may help you: APEX_APPLICATION_PAGE_IR, APEX_APPLICATION_PAGE_IR_CGRPS, APEX_APPLICATION_PAGE_IR_COL, APEX_APPLICATION_PAGE_IR_RPT
It will be indeed a bit messy as you need to look at the person who's watching the report. You'll probably need to parse some fields yourself (like the columns he sees are in format column1:column2 etc)
Maybe the APEX dev team knows a simpler way? or is there an api?
Regards,
Dimitri
http://dgielis.blogspot.com/
http://www.apex-evangelists.com/
http://www.apexblogs.info/

Similar Messages

  • SQL*Developer 'Query Results' Not Displaying

    I have just recently installed SQL*Developer v3.2.2 and after I run a SQL query the tab 'Query Result' tab is not displayed. I have tried to show this tab and to use the arrow keys at the bottom of the screen to display this screen but I cannot view the query results. I have used v1.5.1 in the past and know that it should display when after running a query and can be resized if required but I cannot seem to show it is v3.2.2

    Hi,
    Yes, I did install to a clean directory. I have even deleted all contents of the directory and re downloaded
    the software again to the same directory but this did not work either it still remembered the original settings.Keep in mind there are two locations that an installation updates:
    1. The SQL Developer installation directory (which you deleted).
    2. The User-Related Information (in your "user home" directory), which is updated by the settings migration
    Perhaps Jim meant you should also remove the user settings for the last SQL Developer version installed and possibly even avoid migrating the old 1.5.x settings when you first start SQL Developer after that. See the following forum thread, probably unrelated to your situation, but containing where to find the location of user-related information in the Help:
    Re: IDE issue - Query Result grid is not selectable or scrollable
    Hope this helps,
    Gary
    SQL Developer Team

  • Getting SQL for Prepared/Callable statement objects

    Our current system is using CallableStatements (for performance) to log information to a database table. If there is an exception during this process, we want to log the SQL to a file for recovery later. Obviously, since the CallableStatement SQL statment only contains the '?' placeholders, we don't see the actual data in our logs.
    Does anyone know how to retrieve the data that is inside the statement once it is put in using the set() methods? If not, does anyone know of a "drop-in" replacement that will provide access to that actual data?
    Bob

    This is the best solution i have found: http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower.html

  • Urgent - Related to generic customer exit for Query

    Hello Experts,
    We have a query whose selection screen has two user input variables, plant and fiscper. Let say user enters 001 plant adn fiscper 0012007. We have about 100 rows for this selection. Each row has three date fields D1, D2 and D3. we have requirement that out of these 100 records only those records which meet the condition that D1 falls between D2 and D3 should be displayed as query result, others should be ignored.
    Is there any generic customer exit (Like we have customer exit to manipulate virtual keyfigures) that gets called before query result is displayed where we can play around with the query result before it gets displayed? I am not talking about user exits for customer exit variables.
    Please throw some light on this.
    Thanks
    Sundar

    Hello Sundar,
    You can use conditions for the requirement mentioned.
    Create a Contition on date D1 with operator "Between" and instead of hardcoding the values for the condition use variable entries.There you can create a variable with Customer exit type - to get in the selected range of dates between D2 and D3.
    Thanks
    Sam

  • Dashboard Prompt - Getting error for Adding SQL query in "Default to"

    Hello Oracle,
    I am facing some problem in Dashboard Prompt. Like when i add some sql query in "Default to" in Dashboard prompt and for the next prompt when i check for Contrain option i get error in the second prompt. but it works fine when i hard-code a value in "Default to" options.
    For Example:
    Like when we consider a two prompts :
    1) Year -> (In Default to i select SQL Query and enter the query as SELECT "YTD Dim"."Fiscal Year" FROM "YTD Report" WHERE "YTD Dim"."Fiscal Year" = Year(Current_Date)
    2) Business Unit -> (In specific value i give as some hard code value of Business Unit and check the contrain option)
    i get error as
    Business Unit
    Error Generating Drop Down Values
    A numeric value was expected (received "SELECT "YTD Dim"."Fiscal Year" FROM "YTD Report" WHERE "YTD Dim"."Fiscal Year" = Year(Current_Date)"). Error Details
    Error Codes: EHWH2A7E
    but i get correct value for Year as 2011.
    I need to use SQL query in default to option and need to check the constrain option too.
    Looking for positive feedback.

    You need to create a dashboard prompt and in Default To -> select SQL Results
    Click on the ... (three dots ) underneath it and put in your sql
    For Example , I have a Table called "Sales Date" in my "ABC" presentation folder. This has a column called "Year" and "Date". If I want to have a Year prompt with the default value set to current year, here is what the syntax of my sql result will be :-
    SELECT "ABC"."Sales Date".YEAR
    FROM "ABC"
    WHERE "Date" = current_date
    In SQL, we cannot put SQL as we know of in terms of Oracle, Sql Server etc. The SQL here refers to sql as OBIEE understands it and should be in the form of Select "Presentation foler"."Table Name".ColumnName from "Presentation Folder"
    Hope this helps

  • Getting a early watch alert in production for query display.

    Hi All,
    Getting a early watch alert in production for query display.
    Number of Excel cells send to frontend: 78630 cells to the frontend on average.
    Please suggest to overcome and rectify in the production environment.
    Regards,
    Siddhardh

    Siddhard,
    To set u201CAverage number of Excel Cells send to Frontendu201D to remove/ extend the set 30000 as parameter
    We need to execute the report SAP_RSADMIN_MAINTAIN with parameters
    o     OBJECT = MPRO_MAX_RESULT
    o     VALUE = <maximum size of the interim result in kilobytes>
    Reference: Note # 630500
    Hope this helps.
    -RajNi Reddy

  • APD query key date with variable for time dependent MD display attributes

    Hello,
    In a APD I use a query as a source with a query key date that is filled with a customer exit variable.
    When I run the query as a user, the time dependent MD display attributes look fine. However, when I use the query in an APD, I get no values for the time dependent display attributes.
    Any suggestions?
    Thanks

    Hi,
    Try to run query using RSCRM_BAPI Tcode, this you can also schedule in background
    Thanks
    Reddy

  • Af:query : How to get sql

    Hi,
    How can i get SQL Query that is executing when I enter some criteria and click on Search button of query panel?
    I tried to override executeQuery() method of VOImpl and printed getQuery(). It is showing the query with bind variable in the query and vc_temp for the fields that are added in Advance mode.
    I want to get the actual query that is getting executed.
    Regards,
    Vino

    Can anyone help?

  • Using getter/setter for returing a string variable to display on an Applet

    have two classes called, class A and class testA.
    class A contains an instance variable called title and one getter & setter method. class A as follow.
    public class A extends Applet implements Runnable, KeyListener
         //Use setter and getter of the instance variable
         private String title;
         public void init()
              ASpriteFactory spriteFactory = ASpriteFactory.getSingleton();
              // Find the size of the screen .
              Dimension theDimension = getSize();
              width = theDimension.width;
              height = theDimension.height;
              //Create new ship
              ship = spriteFactory.createNewShip();
              fwdThruster = spriteFactory.createForwardThruster();
              revThruster = spriteFactory.createReverseThruster();
              ufo = spriteFactory.createUfo();
              missile = spriteFactory.createMissile();
              generateStars();
              generatePhotons();
              generateAsteroids();
              generateExplosions();
              initializeFonts();
              initializeGameData();
              //Example from Instructor
              //setMyControlPanel( new MyControlPanel(this) );
              // new for JDK 1.2.2
              addKeyListener(this);
              requestFocus();
         public void update(Graphics theGraphics)
              // Create the offscreen graphics context, if no good one exists.
              if (offGraphics == null || width != offDimension.width || height != offDimension.height)
                   // This better be the same as when the game was started
                   offDimension = getSize();
                   offImage = createImage(offDimension.width, offDimension.height);
                   offGraphics = offImage.getGraphics();
                   offGraphics.setFont(font);
              displayStars();
              displayPhotons();
              displayMissile();
              displayAsteroids();
              displayUfo();
              //displayShip();
              //Load the game with different color of the space ship          
              displayNewShip();
              displayExplosions();
              displayStatus();
              displayInfoScreen();
              // Copy the off screen buffer to the screen.
              theGraphics.drawImage(offImage, 0, 0, this);
         private void displayInfoScreen()
              String message;
              if (!playing)
                   offGraphics.setColor(Color.white);
                   offGraphics.drawString("\'A\' to Change Font Attribute", 25, 35);
                   offGraphics.drawString(getTitle(), (width - fontMetrics.stringWidth(message)) / 2, height / 2
                             - fontHeight);
                   message = "The Training Mission";
                   offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2);
                   message = "Name of Author";
                   offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2
                             + fontHeight);
                   message = "Original Copyright 1998-1999 by Mike Hall";
                   offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2
                             + (fontHeight * 2));
                   if (!loaded)
                        message = "Loading sounds...";
                        int barWidth = 4 * fontWidth + fontMetrics.stringWidth(message);
                        int barHeight = fontHeight;
                        int startX = (width - barWidth) / 2;
                        int startY = 3 * height / 4 - fontMetrics.getMaxAscent();
                        offGraphics.setColor(Color.black);
                        offGraphics.fillRect(startX, startY, barWidth, barHeight);
                        offGraphics.setColor(Color.gray);
                        if (clipTotal > 0)
                             offGraphics.fillRect(startX, startY, (barWidth * clipsLoaded / clipTotal), barHeight);
                        offGraphics.setColor(Color.white);
                        offGraphics.drawRect(startX, startY, barWidth, barHeight);
                        offGraphics
                                  .drawString(message, startX + 2 * fontWidth, startY + fontMetrics.getMaxAscent());
                   else
                        message = "Game Over";
                        offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4);
                        message = "'S' to Start";
                        offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4
                                  + fontHeight);
              else if (paused)
                   offGraphics.setColor(Color.white);
                   message = "Game Paused";
                   offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4);
         public String getTitle() {
              System.out.print(title);
              return title;
         public void setTitle(String title) {
              this.title = title;
    }displayInfoScreen method in class A calls out for getTitle( ) to be displayed on an applet as an initial display string for the application.
    The instance variable title is set by setTitle method which is called out in class testA as follow,
    public class testA extends TestCase
          * testASprite constructor comment.
          * @param name
          *          java.lang.String
         public testA(String name)
              super(name);
          * Insert the method's description here.
          * @param args
          *          java.lang.String[]
         public static void main(String[] args)
              junit.textui.TestRunner.run(suite());
              // need to figure out how to get rid of the frame in this test
              System.exit(0);
         public static Test suite()
              return new TestSuite(testA.class);
          * Basic create and simple checks
         public void testCreate()
              A theGame = new A();
              assertNotNull("game was null!", theGame);
          * Basic create and simple checks
         public void testInit()
              A theGame = new A();
              Frame gameFrame = new Frame("THE GAME");
              gameFrame.add(theGame);
              int width = 640;
              int height = 480;
              gameFrame.setSize(width, height);
              // must pack to get graphics peer
              gameFrame.pack();
              theGame.resize(width, height);
              theGame.setTitle("TEST THE GAME");
              theGame.init();
              assertEquals("ASprite width not set", A.width, width);
              gameFrame.dispose();
              gameFrame.remove(theGame);
    }Basically, class testA invokes the init( ) method in class A and start the applet application. However, it displays a white blank display. If I change the getTitle( ) in the displayInfoScreen method to a fixed string, it works fine. Did I forget anything as far as using getter & setter method? Do I have to specify some type of handle to sync between setter and getter between two classes? Any feedback will be greatly appreciated.
    Thanks.

    Your class A extends runnable which leads me to believe that this is a multi-threaded application. In that case, title may or may not be a shared variable. Who knows? It's impossible to tell from what you posted.
    Anyway, what is happening is that your applet is being painted by the JFrame before setTitle is called. After that, who knows what's happening. It's a complicated application. I suspect that if you called setTitle before you added the applet to the frame, it would work.

  • How can I get dock connector to turn off on air play. There is no longer a choice for sound to be displayed on iPad. I do not own outside speakers. Have already reset. Thanks

    How can I get dock connector to turn off on air play. There is no longer a choice for sound to be displayed on iPad. I do not own outside speakers. Have already reset. Thanks

    Slow, intermittent.  Sometimes bootable sometime not. Odd behavior.
    Sounds to me like a classic case of your HD failing.
    Your SMART status may still show verified, with no errors on the Apple Hardware Test, Disk Utility shows no problems on Disk Repair-  this is of no help.
    I trust you have a good back-up and a bootable clone.
    http://eshop.macsales.com/shop/hard-drives/2.5-Notebook/

  • SQL Developer replacement for Query Builder?

    Our developers use query builder to quickly develop sql code w/conditions, joins, where clauses, etc. I just installed release 2 of SQL Developer and am trying to figure out if this is a viable replacement for query builder. Is there a graphical "query builder" component as part of SQL Developer?

    Barry, I would agree that it should be clean and easy to use. I started using Data Browser 2.0 and migrated to Query Builder 6.0.7.1.0 and while Query Builder is no longer it's own product it's integrated into Reports Developer 10g. The basic layout and operation has been consistent thru the life cycle and I would think you'd keep the "look and feel" consistent with what's currently available. (might simplify integrating it too). My biggest complaint with Query Builder 6.0.7 (se don't use the 10g version) is that it errors when opening a schema with more than 8192 objects. As an E-Business Suite 11.5.10 customer this is an issue for our developers when logging in as the standard APPS user.
    So here would be my "wish list"
    1. consistent look and feel with "older" versions of Browser/Query Builder
    2. removal of 8192 object limitation
    3. ability to open older .brw format files
    Certainly more improvements would be possible by integrating with SQL Developer and would be welcomed - this wish list is coming from a user who has MANY .brw files in the older 6.0.7 format.

  • T530 Display gets black for seconds

    I use my T530 with two monitors with extended desktop. The external monitor is the main display.
    Since I updated to Win8.1, at irregular intervals (seconds or minutes) both displays gets black for a second, all windows are moved to the laptop-display for a short time and then back to the main display.
    It´s extremly annoying and it is not possible to use the monitors seperate.
    Sometimes there is a message, that the GPU is ready to save energy.
    All drivers are current and from the lenovo homepage.
    Has anybody an idea?
    Thanks in advance.
    Ulli

    Do you have an Apple Care extended warranty because it sounds like the begining of inverter failure. If it is a bad inverter, that is a hardware failure and can't be fixed with software.

  • Get only last level in SQL Hierarchy Query

    Hi,
    How to get only the last level in Oracle SQL Hierarchy Query?
    Thanks

    Hi,
    1007372 wrote:
    Hi,
    How to get only the last level in Oracle SQL Hierarchy Query?Depending on your requirements:
    WHERE   CONNECT_BY_ISLEAF  = 1 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    If you can show what you want to do using commonly available tables (such as scott.emp, which contains a hierarchy), then you don't need to post any sample data; just the results and the explanation.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0). This is always important, but especially so with CONNECT BY queries, because every version since Oracle 7 has had significant improvements in this area.
    See the forum FAQ {message:id=9360002}

  • Get sql query type

    Hey all,
    I'm trying to check if the sql query is an insert or a select before executing it.
    preparedstatements doesnt give such information.
    is there a way to find the type?
    thanks

    warnerja wrote:
    jonnyd9191 wrote:
    you can do something like:
    String sql = "Some statement"
    if (sql.length() >= 6)
    String Type = sql.substring(0, 6);
    if  (Type.equalsIgnoreCase("select"))
    ResultSet resultSet = statement.executeQuery(sql);  // for select statements
    else
    statement.executeUpdate(sql); // for inserts and updates
    Hack alert!
    No good. What about calls to stored procedures which might return a resultset or not depending on their implementation? And if you accommodate them in your parsing code there, you're likely going to miss something else as well, and so forth, until eventually you've basically reinvented the SQL parsing wheel.While you are right the OP did only say "select" and "insert"

  • Windows Explorer doesn't display some files until I play or get info for them in iTunes.

    Windows Explorer doesn't display some files until I play or get info for them in iTunes.
    How do I get them to all show up in Explorer without playing them all one by one?

    I think I solved the problem by going to File -> Library -> Organize Library

Maybe you are looking for

  • Unable to save PDF files (sometimes?)

    Hi All, There are times when I'm working with Elements 6.0 that everything is working normally. I can play and adjust and save files to my little hearts desire. There are other times when I'll open a file, make my adjustments, save the file and when

  • Steps for using .wmv file in FCE

    I have used FCE to edit files captured on my camera for a while now. But I was sent a DVD with an .wmv I would like to edit in FCE. I have never done this, and really need a very basic, step by step directions for how to convert this file for use in

  • My iPhone just randomly stopped working

    Hi everyone, was wondering if anyone has been having this problem. What happened was, when i was listening to music on my iStation at home the music randomly stopped, i thought i maybe the iStation stopped working but it turned out that my iPhone had

  • No web with safari, itunes, but can with all other apps.

    Hi I get no web connection with Safari and iTunes, but I can with all other apps. (Firefox, Entourage, Mail, Transmit-FTP) iTunes says: connection denied, Safari says: web page not found, but every other web app I have can connect. What gives?

  • Hide zero rows - have values in hidden col, but formula col in rpt is -0-

    In Hyperion Reporting Studio, I have a report that's set up as follows: Row1: Descendants of Projects Columns: A - C are data columns (hidden) D - formula [A] - - [C] (shown on report) Basic suppression is chosen for row1. In the report, column D sti