PLSQL Blocks and SQL Queries in APEX

Hello,
Is it possible at all to view undelrying Oracle PLSQL and SQL queries in a run time APEX 3.2 application?
More elaboratively, can a smart APEX Site user or visitor find a way to see underlying SQL queries and PLSQL code objects?
Thanks,
R

Hi,
If you just want to see what sql is executed by a session you can use sql trace. This can be switched on for a whole system but is usually more usable when switched on for individual users. The problem with a system like APEX is that database sessions are not directly associated with APEX users and APEX sessions can share database sessions.
I haven't tried it, but one method that may work is to put a schema logon trigger on the APEX_PUBLIC_USER which switches on tracing when ever this user logs on to the database. It may take a little detective work to understand the sequence of things but all the SQL executed by this user will be recorded and can be analyzed for performance etc. The command to enable SQL tracing could be embedded in the APEX app, but it may be a little random as to which db session has it enabled.
Perhaps a better tracing option could be seen as a feature request in a future version of APEX.
Regards
Andre

Similar Messages

  • How exit for a script having set of pl/sql blocks and sql queries

    HI,
    I have set of blocks and sql queries in a script.
    In some cases I want to stop the excution of next statements and blocks.
    As in pl/sql block We can use return , in case of loop we can use exit, so what is to be use in case if sql script which contain set of blocks and sql queries.
    Thanks and Regards in Advance,

    Hi,
    how to exit from the script if confirm_to_continue is set to 'N'.
    i.e in this case I want the preceding statements not to be excuted.
    Please suggest.
    script:
    declare /*BLOCK NO1*/
    begin
    IF &&confirm_to_continue = 'N'
    THEN
    ---exit from from whole script
    RETURN; -- this will only exit from this block
    END IF;
    end;
    host IF EXIST &file_name (del &file_name) ELSE (echo missing)
    declare /*BLOCK NO 2*/
    begin
    end;
    /

  • Business Logic - Success of Tag and SQL Queries

    Greetings All,
    I have a Logic flow from an old NQL process. 
    The process Gets some SQL and Tag Data then checks to see if data was returned and notifies via email if data wasn't returned.  So this would translate into the Tag and SQL Queries followed by a Logic Conditional block.
    HERE's the questions:
    In BLS, if the SQL and/or Tag Query fail, the entire process quits (at least when Executed locally) and never gets to the Logic Conditional block to verify the tagQuery.success or SQLQuery.success.
    Is this what it does when run as a scheduled task also???
    Is there any onError then do... type of parameter???
    Any Suggestions would be appreciated...
    Thanks
    Dennis West

    Dennis, it shouldn't "quit".  The Success property should be set to false, and the error caught (typically).  Sounds like a bug.

  • Authorisation Groups and SQL Queries

    I want to give some employees access to certain SQL queries in SAP1.
    I've created a Category Name and have ticked the Authorisation Group 1. Within this Category I've saved my queries that I want users to access.
    I've then gone to Authorisations, General Authorisations, Selected the Employee, then Reports, Query Generator, and then allowed full authorisation to Saved Queries Group No. 1 and Read Only rights to Query Manager.
    When user goes to Tools Queries, and selects Category name and any SQL query therein, cannot open.
    I've tried allowing them full authorisation to Query Manager but this gives users access to ALL queries.
    Any thoughts anyone?
    D

    Where is your Query Manager Authorisation ? I could only find Query Generator.  If the same apply to you, then you don't need to assign any right to this category but only the selected group to full. Query Generator Authorisation will automatically become Various Authorisation.
    Thanks,
    Gordon

  • Dyn sql execute immediate  A plsql block returning sql%rowcount of rows inserted

    I would like to get the number of rows inserted in a dynamic sql statement like following.
    execute immediate
    'begin insert into a(c1,c2,c3)
    (select ac1,ac2,ac3 from ac where ac1=:thekey
    UNION select tc1,tc2,tc3 from tc where tc1=:otherkey); end;' using in key1,in key2;
    I have tried per the oracle8i dyn sql chapter in doc RETURN sql%rowcount won't compile.
    also add this to statement 'returning sql%rowcount into :rowcount'
    no luck.
    any ideas.?
    thanks.

    Quick comment first - I'm not sure why you are even using dynamic SQL here. There is nothing dynamic about your statement. It is equivalent to just:
    insert into a (c1, c2, c3)
      select ac1, ac2, ac3
        from ac
       where ac1 = key1
      UNION
      select tc1, tc2, tc3
        from tc
       where tc1 = key2;Unless you are really dynamically changing a table or column name here and just didn't show it in your example, you certainly don't want the overhead of NDS for this insert in this situation.
    In any case, you just need to evaluate SQL%ROWCOUNT in the next statement.
    insert ...;
    if sql%rowcount = 0 then
      -- nothing was inserted
    end if;

  • JSP and SQL Queries

    Hello,
    If a JSP application needs Database connectivity to display some values, what is the best approch for the same.
    1. Using SQL connections with resultset
    2. Using Java Class and using the same in JSP.
    3. any other??
    what is the industry standard for the same.
    Thnx,,
    Girish

    JSP's are used to display a view (such as a user interface or a report). Database connectivity is business logic and you don't do business logic in JSP's. I would create a servlet to handle business logic and then put the database logic in seperate classes that you can call from the servlet. Then use a JSP with JSTL to display the results of the database query. Putting the business logic in seperate classes makes it reusable.
    Frameworks such as Struts, Spring, JSF, etc. work in similar ways, so I guess you can call it an "industry standard". In software development there is no such thing however, you develop to solve a problem, not to follow standards.
    If you want to do it this way I suggest you lookup these two things:
    1) how to make servlets and JSP's work together
    2) the Model View Controller pattern

  • Indexes and SQL queries

    I want to know if the index would be used with this query.
    >
    I have a table with 4 columns -- columns A,B,C, and D.
    I have a unique index on columns A,B,and C.
    If my SQL statement includes only columns A and B in the where clause, would this index be used?
    The user arrived at from
    The user appears to be using Microsoft Internet Explorer 4.0 (compatible; MSIE 4.01; Windows NT)null

    Yes the index is used.
    It's important that your clause contains column A (the firsto of the index)

  • Plsql block as required

    hi ,
    a plsql block and the result will be like
    --> Title01 has taken by zero students.
    --> Title02 has taken by ten students.
    --> Title03 has taken by five students.
    i got a question in this manner i am a beginner kinda help me out .
    regards,
    beginner..

    8934589 wrote:
    yes, but the question was put like this and i literally unable to understand....Surely you have a table structure you are working with?
    Surely you could ask your instructor for more details?
    Surely you could ask your fellow students to help, given that they know the context which you have withheld from us?
    Go back and re-read your original post and ask yourself how a total stranger would make anything of it at all.
    We don't know what a "Title01" (or 2 or 3) is.
    Wed don't know what a student is.
    We don't know that it means for a "Title01" to be taken (or not) by a "student"
    But whatever it is, I'd be willing to bet that, given no further requirements, that a simple SQL query would do it, and no PL/SQL would be needed.
    Edited by: EdStevens on May 29, 2013 10:08 AM

  • SPEL - Using SQL queries along with Function security

    Hi,
    I have tried the basic features of SPEL using function security and VO attribute. I would like to know if there is a way where I can write SQL or PLSQL blocks and set SPEL.
    I am trying to relate the functionality of Oracle Forms, where we can personalize and perform actions depending on the SQL statements.
    Could you please help.
    Regards,
    BM

    Hi Sushant,
    Thanks for the reply. I am aware of extending a view object and setting SPEL. I want a method where I can achieve SPEL without extending any BC4J object.
    Regards,
    BM

  • Need to write a plsql block for calling another procedure.

    Hi Guys,
    I have a requirement to write a plsql block and to call another procedure which is having 5 parameters (each parameter having multiple values). Calling procedure generates one SQL query and it needs to be generated all combinations and print in another table.
    I need to pass multiple values for first three parameters from my PLSQL block and run.
    call sample proc:
    procedure(
    param1 varchar2,
    param2 p_varchar2,
    param3 p_varchar2,
    param4 in varchar2,
    param5 in number
    is
    begin
    ls_sql_query := 'with client_query as (select * from table)';
    end;
    Thanks in advance!
    Rgds,
    LRK

    This article is on exactly your subject. It is worth a careful read.
    Ask Tom: On Popularity and Natural Selection
    I paraphrase: "Always code a reference to every possible bind variable but do so in such a way that the optimizer removes the bind variable for us if we aren't going to actually use it in that particular execution of the SQL statement."
    P.S. This is the same answer I gave when you asked the same question earlier.

  • SQL Queries in Code V/s Stored Procedures

    Hi Friend,
    Can any one of you guide me with following..
    What is faster ? using SQL Queries in Java code or using Stored Procedures which are called from code?
    I understnd Stroed Procedures are faster and definitely it provides more maintainability.
    If any one can give me any links or resources which outlines pros and cons of using Stored Proc and SQL Queries embedded in Java than it would be a great help..
    If there are any articles which proves either of the above is a preferred way, that would also help..
    Appreciate the effort in advance !!
    Thanks
    Gurudatt

    Well one benefit of Stored Procs is that you "compile" it on the database whereas you might build your query on the fly in java... test coverage is important in order not to have such things as a typo in a column name....
    Still, if you change a table, you have to go through all the procedures in SQL and likely to do so in some of your business object... and trust me, that can be hell!
    It all depends on the use of the app...
    From my experience, Stored procedure are much faster than built-on-the-fly SQL (and quite faster than prepared statements depending on the JDBC driver, the re-use of connections etc...)....
    IMHO, you'd probably be wise to start of with prepared statements, and when the schema seems stable enough (ie unlikely to change), look for the slower queries and convert them to stroed procedures.
    If you don't have to support several databases and are tight on performance, you can even include some logic in your stored procedure (e.g. update several tables, based on various selects...etc...). The language is usually quite powerful, and that can save you the run-time of selecting, converting to object , process and update (i.e. several roud-trip between DB and app)...
    Tshcuss!
    Chris

  • Execute multiple sql queries in plsql

    Hello All,
    I have two queries, How to execute multiple sql queries in plsql. Once the query completed in sql+ that report/output has to come in html.
    Please guide to how to do that.
    Thanks and Regards,
    Muthu
    [email protected]

    There are several ways to do what you are wanting, but you should consider posting your question in the correct forum (PL/SQL). This forum is for question about Oracle Forms! :)
    As to your question, take a look at this: How to output query results as HTML.
    Craig...

  • ? in SQL Queries and not using prepared statements

    Using EclipseLink 1.1.1
    Prepared Statements are disabled
    In our production server something went wrong and one of our Read Queries started erroring. A DatabaseException was thrown and we log the "getQuery.getSQLString()" statement. We found this query in the logs:
    SELECT t1.ID, t1.NAME, t1.DESCRIPTION, t1.EXTREFID, t1.STYLESHEET, t1.DDSVNVERSION, t1.FIRSTNAME, t1.LASTNAME, t1.EMAILADDR, t1.PHONENUMBER, t1.ADDRESS, t1.ADDRESS2, t1.CITY, t1.STATE, t1.POSTALCODE, t1.COUNTRY, t1.ADMINACCTNAME, t1.HASDOCUMENTS, t1.HASTIMEDNOTIFICATIONS, t1.STATUS, t1.ENTRYDATE, t1.EVALEXPDATE, t1.LASTREMINDDATE, t1.FULLUSERS, t1.LIMUSERS, t1.REQUSERS, t1.ISENTERPRISE, t1.EXPDATE, t1.ISDISABLED, t1.DISABLEDDATE, t1.NEEDLICENSEAGREEMENT, t1.ISWARNINGDISABLED, t1.LOCALE, t1.TIMEZONE, t1.CURRENCY, t1.DOMAIN, t1.DOCUMENTSIZE, t1.EXTRADOCUMENTSTORAGE, t1.ONDEMANDOPTIONS, t1.SSOTYPE, t1.RESELLERID, t1.ACCOUNTREPID, t1.LASTUSAGEREPORTDATE, t1.NEXTUSAGEREPORTDATE, t1.USAGEREPORTATTEMPTS FROM T_SSOOPTIONS t0, T_CUSTOMERS t1 WHERE *((((t0.SSOENABLED = ?) AND (t1.SSOTYPE IN (?, ?))) AND (UPPER(t1.DOMAIN) = ?)) AND (t0.CUSTOMERID = t1.ID))*
    Notice the values weren't entered into the where clause. We had to bounce the application to fix the problem. I've never seen this before. I've added more debugging statements to the code - so if this happens again in the future I'll have more information to report on. In the mean time I'm wondering if anyone else has every seen a problem of this nature.

    Database error due to invalid SQL statement.
    I don't have a stack, we were catching the exception and not printing the stack :(
    Like I mentioned in my first post, I added more debugging code (e.printStackTrace()). I understand this is hard to track down without more information. I was just hoping you guys had seen something like this before and had any insight. Like I mentioned before: this is on our production server. I've never seen this type of error before. That particular server (we run in a cluster mode) had been up for several days and then started generating that error. IT bounced the node and everything went back to normal. We have been using toplink for about 5 years now and have never seen this problem, until August 3rd 2009. The only thing that has changed recently is our migration from toplink 10 to EclipseLink. I was wondering if anyone knows if anything had changed in EclipseLink/toplink 11 with the generation of SQL queries.
    I'll keep looking. There is more debugging code in there now. Since the error was "Database error due to invalid SQL statement" this implies the SQL was generated, exited that part of the code and was sent to the db where it failed. I'm afraid the printStackTrace won't help if this error happens again.

  • Am facing this error sqlcode :-6502 while running sql code in plsql block

    Am facing this error sqlcode :-6502 while running sql code in plsql block.
    am using query :
    SELECT SUBSTR('123456DE789KL|987654321|B',1,INSTR('123456DE789KL|987654321|B','|')-1) FROM DUAL;
    CAN any body tell me why.

    BD_Fayez wrote:
    I've tried the following, but don't get any error.As I mentioned, most likely variable is too short:
    SQL> declare
      2  strSub varchar2(2);
      3  begin
      4  SELECT SUBSTR('123456DE789KL|987654321|B',1,INSTR('123456DE789KL|987654321|B','|')-1) into strSub FROM DUAL;
      5  dbms_output.put_line(strSub);
      6  end;
      7  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 4
    SQL> SY.

  • Remote debugging with APEX and SQL Developer

    Hi,
    I have problems concerning breakpoints within my SQL Packages I want to debug.
    I want to force SQL-Developer to suspend execution of a function, so I can get forward step by step.
    The SQL-Developer do not stop executing at the breakpoints I set in the Package.
    The message I get is the following (on SQL-Developer side):
    Debugger accepted connection from remote process on port 4000.
    Processing 110 classes that have already been prepared...
    Finished processing prepared classes.
    Debugger disconnected from remote process.
    Seems to me, that the process runs into the debug-mode but leave without stopping at a given breakpoint??
    Do anybody have an idea how to solve it?
    We use Oracle 10.2.0.3.0, SQL Developer 1.5.1 and APEX 3.1.2.
    The Package-function I want to debug runs on another Oracle database as the APEX application.
    Thanks in advance
    Regards
    Norbert
    Edited by: Norbert2 on Apr 20, 2009 5:47 AM

    Hi Carsten,
    now I have done a further step. I can debug a remote PL/SQL-Package through APEX, but now I get an exception when the program execution jumps back to the APEX PL/SQL-Package.
    My APEX-Page-Process looks like this:
    BEGIN
      dbms_debug_jdwp.connect_tcp(host => 'IP-ADDRESS', port => '4201');
      APEX_TEST_PKG.remoteDebug;
      dbms_debug_jdwp.disconnect;
    END;The procedure APEX_TEST_PKG.remoteDebug looks like this (located on the APEX-DB):
    PROCEDURE startRemoteDebug
      AS 
        v_string    VARCHAR2(50)   := '';
      BEGIN
        [email protected](host => 'IP-ADDRESS', port => '4000',
                 option_flags => dbms_debug_jdwp.connect_defer_suspension);
        v_string := [email protected];
        DBMS_OUTPUT.PUT_LINE(v_string);
        [email protected];
      END remoteDebug; The procedure REMOTE_TEST_PKG.testFunc looks like this (located on the Remote-DB):
    FUNCTION testFunc RETURN VARCHAR2
      AS 
        v_string    VARCHAR2(50)   := '';
      BEGIN        
        v_string := 'Test';
      RETURN v_string;
    END testFunc; When I start the debug session without the option dbms_debug_jdwp.connect_defer_suspension, I get an exception Oracle.EXCEPTION_ORA_604.
    Starting the debug session with the above mentioned option, I am able to debug the remote function.
    But now I get an exception when the executor tries leaving the remote function going back to the invoking function. With the debugger I can step over the return-statment successfully and the debugger steps on the next line END testFunc;. On this line I get the exception above
    Exception breakpoint occurred at line -1 of PBREAK.pls.
    $Oracle.Builtin.EXCEPTION_USER:
    Exception breakpoint occurred at line -1 of PBREAK.pls.
    $Oracle.Builtin.EXCEPTION_USER: I tried another way where I get now exception and where I can step through my functions in APEX, descending to functions in the remote db and going back to APEX.
    For this case I put the debug-statements in remote function:
    FUNCTION testFunc RETURN VARCHAR2
      AS 
        v_string    VARCHAR2(50)   := '';
      BEGIN        
        dbms_debug_jdwp.connect_tcp(host => 'IP-ADDRESS', port => '4000');
        v_string := 'Test';
        dbms_debug_jdwp.disconnect;  
      RETURN v_string;
    END testFunc; But I have no idea why it doesn't work properly starting the remote debug session in the apex procedure.
    Regards
    Michael
    Edited by: user6044915 on 02.09.2009 04:08
    Edited by: user6044915 on 02.09.2009 04:21
    Edited by: user6044915 on 02.09.2009 04:28

Maybe you are looking for

  • Is it possible to create a price list which is non-taxable?

    Is it possible to create a price list which is non-taxable?

  • Interactive Report Link Column HELP FROM GURUS requested

    Hi, I have an interactive report the data of which returns a file name for an image. I would like to use the Link Column (Link to Custom Target) option. The column in my underlying query has the image file name #ILINK#. The Target URL is correctly fo

  • Can i back my entire computer up to my server and if so how?

    I would like this to be done similar to the way time capsule works. I was wondering if it is even possible to back the whole computer up to the server

  • Posting foreign currency

    Hi Gurus! During the posting  t-code F-02 or F-30 with foreign currency, system calculate getting converted automatically by using the rates specified in OB08 the local currency, but when to change the amount (foreign currency), system no replace amo

  • Connecting Itouch to Itunes

    I am getting an error message when I try to load my new ITouch to my existing ITunes account - it says it is unable to sync because it can't located the "disc" Any ideas how to fix this? I've downloaded ITunes 7.6 and restarted the computer. Also, if