Function returning the query takes longer to run in Apex4.0

Hi all

I've created a report using the function returns the query. The function returns the query based on parameters that returns the dynamic columns. When I run the query in sql developer the query generates and returns the result in 3mins. But in the apex, it takes 35 minutes maximum to return.

The query returns about 10000 lines.

What a performance problem in the query or Apex? can someone help plz

Concerning
REDA

No it's just the first tranche of 500. You can run it in good old SQL * more and the total time of the time (be patient however)

Tags: Database

Similar Questions

  • How to get the query of the region "PL/SQL function body returns the query string"?

    Hello

    is it possible to get the query string from the region of type "PL/SQL function body returns the query string"?

    I can get the definition of the region as a PL/SQL procedure, but I am interested in the returned query. I tried to write something like

    < pre > v_return_query: = «...» » ;
    : P49_QUERY: = v_return_query;
    Return v_return_query; < / pre >

    to save the return on hidden item P49_QUERY string, but it does not work. I get the error message: ERR-1002 cannot find the item for the "P49_QUERY" element ID in the application '4000 '.

    Kind regards
    Przemek

    If you need to make reference to a page element in the block then you can use this type of control to avoid having to use generic column names:

    if apex_application.get_current_flow_sgid(:APP_ID) = apex_application.get_sgid then-- runtime  :P9_SQL := vSQL;else-- design time  null;end if;
    

    But if all you want to do is capture the SQL debugging you can take all the references element in the block and use the insert statement (in a debug table) as I showed earlier.

    Scott

  • FIRST analytical functions returns the null line

    The following query returns a null line when there is no such thing as a line for the predicate. Is it a bug or expected behaviour. If so what is the meaning of the null row, is it not logical?



    SELECT NVL (max (ah.fyr_end_dt) KEEP (DENSE_RANK FIRST ORDER BY ah.as_of_dt DESC), ' RETURNED NULL')
    Of account_history ah
    WHERE
    Ah.acct_id = 999
    AND trunc (ah.as_of_dt) < = 31 December 08 '
    ;

    Hello

    user4900730 wrote:
    Moreover, in my example how I distinguish the case where a line really exists, but the column is null when there is no such thing as a line and the FIRST function returns the same value null? Hopefullly I should be able to do it in a single SQL and know the difference?

    COUNT (*) > 0, but COUNT (col_x) = 0, then there is a line, but col_x happened to be null.

    For example, the following query shows that there is 1 row in the group with the lowest name ("ADAMS"), but the column comm in all ranks of this group is null:

    SELECT     COUNT (*)    KEEP (DENSE_RANK FIRST ORDER BY ename)
                              AS total_cnt
    ,     COUNT (comm) KEEP (DENSE_RANK FIRST ORDER BY ename)
                              AS comm_cnt
    FROM     scott.emp
    ;
    

    Output:

     TOTAL_CNT   COMM_CNT
    ---------- ----------
             1          0
    

    The employee whose highest name ("WARD") has a number in the comm column.

  • How to get the query execution time without running...?

    Hello

    I had one condition... as follows...
    I had 3 sql statements. I need to run only sql what runtime is very less.

    Can someone help me, how to get the time query and run this query without using explain plan... ?

    Thank you
    Rajesh

    I can't think in any way at all to get the query execution time without running the query.

    You might get an estimate ( approximation ) If you are using explain plan.

    But you have governed to explain plan for a reason, so I can't help you.
    Why you do not want to use don't explain plan?

  • How to stop the query takes too long

    Is there a way to tell oracle to stop a query that takes too long to run?

    I'm trying to end a way to prevent some users from running any querys that takes more than 2 minutes... any help?

    I use 10g

    Thank you!

    Hello

    You can create a profile... and limit...

    CREATE a PROFILE prof_low LIMIT
    CPU_PER_CALL 3000 (about 30 seconds)
    PRIVATE_SGA 500K
    LOGICAL_READS_PER_CALL 1000;

    ALTER USER myuser PROFILE prof_low;

    Concerning
    Joao Oliveira

  • DELETE the query takes a long time

    Hi all guru.

    My Version of DB: 10.2.0
    OS: Windows Server 2003

    I run a delete on a table of paritioned command to remove all the lines in one of the parition. The command is:

    The table name is cat_in_data_052012

    delete CAT_IN_DATA_052012 WHERE name of FILE AS: SYS_B_O


    Table conatins million record.


    Thanks in advance

    >
    I run a delete on a table of paritioned command to remove all the lines in one of the parition. The command is:

    The table name is cat_in_data_052012

    delete CAT_IN_DATA_052012 WHERE name of FILE AS: SYS_B_O
    >
    Mention the name of partition specifically in the query to ensure that only one partition is affected.

    See the example (at the end) for the deletion of rows in a Partition in the SQL reference Guide
    http://docs.Oracle.com/CD/B12037_01/server.101/b10759/statements_8005.htm#i2126857

    Deleting Rows from a Partition: Example
    
    The following example removes rows from partition sales_q1_1998 of the sh.sales table:
    
    DELETE FROM sales PARTITION (sales_q1_1998)
       WHERE amount_sold > 10000;
    
  • Create a branch to function returns the URL - new tab

    APEX 4.2.2

    I have a branch of type creates a branch to the function return URL that returns a URL. The branch is triggered via a page element button. The branches of the page at the URL very well but the URL has nothing to do with the application, it is an external URL, so I want to open the link in a new browser tab. Using the link attributes, this is done by using target = "_blank" but I don't see a way to do that in this situation. Seems simple enough, what don't get me? Thank you

    HELEN wrote:
    APEX 4.2.2

    I have a branch of type creates a branch to the function return URL that returns a URL. The branch is triggered via a page element button. The branches of the page at the URL very well but the URL has nothing to do with the application, it is an external URL, so I want to open the link in a new browser tab. Using the link attributes, this is done by using target = "_blank" but I don't see a way to do that in this situation. Seems simple enough, what don't get me?

    Nothing. It is not possible to do this using a branch as the changing context of the browser should be initiated by the browser, not the server. Use JavaScript to do this automatically:

    window.open('', '_blank');
    

    I'd go with changing the direction if it branches to the original page, setting a value of ASK for use as a condition on dynamic action of The Execution of JavaScript Code that runs the window.open.

  • function returning the text validation error

    Hello

    I have a page where I can insert/update user, organization, responsible.
    Organization can be nullable.

    A single user can both be responsible for an organization.

    To check this responsible for validation, I made a function that returns the error of validation of text as follows:

    BEGIN
    FOR c IN (SELECT usr_spa
    OF kpi_users
    WHERE usr_org_id =: p22_usr_org_id
    )
    LOOP
    IF upper(:p22_usr_spa) = upper('YES') and upper (c.usr_spa) = upper('YES')
    THEN
    RETURN 'user is already responsible for this organization' |'. ' ;
    END IF;

    END LOOP;

    END;

    The validation works fine.

    But it won't when I want to insert a new user, without attributing it to an organization.
    I get the following message:

    ORA-01722: invalid number

    Cannot run the validation of the "body of the function return text' ERR-1024.

    Can someone please help me solve this problem?

    Thank you

    Hello

    The user selects a body in a select list? If the default value is considered "null %"? If so, you could modify the test to the IF: P22_USR_ORG_ID <>'% "| 'null %' THEN

    Andy

  • Why the HTTP become function returns the error code 63?

    I tried to use the get HTTP function to get the XML file is returned by the api Google MAPS distance-matrix. I got the right answer if I insert the url directly in the browser, but using the get HTTP function, it returns the error 63, why?

    This is my code (the VI is developed on LV2011).

    I guess, the VI GET for use with LabVIEW Web Service, only not to get of the Internet pages.

    Using the simplest way:

    Andrey.

  • VALIDATION - function returns the error text

    I have a domain that occurs on about 12 pages, I need to post this field with some code

    I created a function on the database that performs this validation, I pass the field value to the function and it returns some text of error, or NULL if the value is correct

    I can't for the life of figure me out how to call the function of APEX

    I've tried everything

    FUNCTION RETURN ERROR TEXT, Expression SQL, PL/SQL Expression... nothing works!

    to call the function my comand is

    FN_VALIDATE_HR1_REF (: P1_GCI,: P1_HR1_REF);

    I want to return the error on the function text and display it in the banner of APEX error

    any help greatly appreciated

    A function like this return error text should work:

    Return (FN_VALIDATE_HR1_REF (: P1_GCI,: P1_HR1_REF));

    Is giving the error?

  • Function returning the tree used with the object type

    Hi guys!

    I'm fighting for some time now of a function that should return the tree structure of the employees. Let me clarify...
    I have a table say Manager and employees (two columns for an example)
    MANAGER_ID
    EMPLOYEE_ID

    Example:

    MAN_ID - 1; EMPLOYE_ID - 2;
    MAN_ID - 2; EMPLOYE_ID - 3;
    MAN_ID - 2; EMPLOYE_ID - 4;
    MAN_ID - 4; EMPLOYE_ID - 5

    The purpose of my function is back for a specified MAN_ID everyone in the tree...

    Example:

    RETURN_TREE (1) return {2,3,4,5};
    RETURN_TREE (2) returns {3,4,5};
    RETURN_TREE (4) returns {5};

    How to get there?

    With respect,

    PsmakR

    And use BULK COLLECT or the COLLECT function to build the collection:

    create type emp_table as table of number(6);
    /
    
    DECLARE
     v_emp_list emp_table;
    BEGIN
     select cast(collect(employee_id) as emp_table)
     into v_emp_list
     from employees
     connect by prior employee_id = manager_id
     start with manager_id = :p_man_id
    
     -- or
     /*
     select employee_id
     bulk collect into v_emp_list
     from employees
     connect by prior employee_id = manager_id
     start with manager_id = :p_man_id
     */
    END;
    /
    
  • Select the query takes a long time to run the second time

    Hi all

    I have Oracle 11 GR 1 material in windows server 2008 R2.
    I have a few tables with 10 million documents. When I run the select query to the tables of first time, it gives me a result in 15 seconds, but if I run the script even twice in the same session, I get the result in 15 minutes to complete...

    Why it's happening? What can be the solution for this?

    Thank you and best regards,
    Vikash jain (DBA Junior)

    What I know is that this feedback from cardinality generates more problems than improving the performance is, in fact, its main objective. But first look at which is was written in the link I posted above

    "Return of cardinality was introduced in the Oracle 11 g database 2. The purpose of this function is to automatically improve plans for queries that are executed repeatedly, _For that the optimizer does not estimate the cardinalities in the properly_ plan"

    If the cardinality feedback kiks in your case it is certainly because you do not have an exact statistics. Get the command the explain plans that I have shown you with the E-lines and A-lines (lines estimates and actual lines) and see where things are poorly estimated.

    If you want to disable the cardinality feedback then add the indicator according to your request

    /*+ opt_param('_optimizer_use_feedback','false') */
    

    Best regards

    Mohamed Houri
    www.hourim.WordPress.com

    Published by: Mohamed Houri on November 22, 2012 02:11
    Published by: I was looking for the exact indication of how do I deactivate the cardinality feedback and I foud in an ot the Dominic post in otn :-)

    Published by: Mohamed Houri on November 22, 2012 02:15

  • Function returns the object type

    Hello
    This isn't a duplicate of another thread, I posted earlier with the procedure...
    Now I try the subprogramme with the service, as required by the client., so I opened the question in another thread
    CREATE OR REPLACE TYPE Type_Rt IS OBJECT
        (Rt_Type      VARCHAR2(2000),
         cdtRt       VARCHAR2(2000),
         lqdtRt    VARCHAR2(2000),
         Olk              VARCHAR2(2000),
         cdtwh       VARCHAR2(2000) )
     
    CREATE OR REPLACE TYPE Rt_Type_Var IS TABLE OF Type_Rt;
     
     
     
    CREATE OR REPLACE FUNCTION FUNC_RAT (
                                Cp_Id  VARCHAR2,
                                             St_Id    VARCHAR2,
                                             cdt_Rt   VARCHAR2,
                                             liq_Rt      VARCHAR2,
                                             Olk      VARCHAR2,
                                             cdt_Wh VARCHAR2)               
    RETRUN Rt_Type_Var IS
       v_typ_rat_List   Type_Rt ;
       var1_nri varchar2(100) := 'ST';
    BEGIN
       IF ( Cp_Id = 'NTE' AND St_Id = 'Y' ) THEN   
        --select distinct ne_rt_issue into var1_nri from rt_con where ltr_ener = cdt_rt;
             
         v_typ_rat_List := new Type_Rt ('STRT',var1_nri ,liq_Rt,'Stle' ,null);    
       END IF;      
         RETURN v_typ_rat_List;
    END;
    / 
    I get the following error:, I tried it but no luck on my side
    PLS-00382: expression is of wrong type
    After you create the function, I have to call this function as
    SELECT * FROM TABLE(FUNC_RAT ('NTE','Y','AB','C','Y',NULL))
    Could you please help me with this

    The same basic problem as in your previous thread. Confusion between creating an object from a collection/table of this object.

    Here's a basic example:

    SQL> create or replace type TScalar is object(
      2          id      integer,
      3          name    varchar2(10)
      4  );
      5  /
    
    Type created.
    
    SQL>
    SQL> create or replace type TArray is table of TScalar;
      2  /
    
    Type created.
    
    SQL>
    SQL> --// creating a scalar
    SQL> select TScalar( 1, 'John' ) as OBJ from dual;
    
    OBJ(ID, NAME)
    --------------------
    TSCALAR(1, 'John')
    
    SQL>
    SQL> --// creating an array/collection
    SQL> select
      2          TArray(
      3                  TScalar( 1, 'John' ),
      4                  TScalar( 2, 'Tom' )
      5          )                               as ARRAY
      6  from       dual;
    
    ARRAY(ID, NAME)
    --------------------------------------------------
    TARRAY(TSCALAR(1, 'John'), TSCALAR(2, 'Tom'))
    
    SQL> 
    

    So in your function, you will need to place objects in the collection.

    return(
        Rt_Type_Var(                      --// instantiate the collection
               Type_Rt ('STRT',var1_nri ,liq_Rt,'Stle' ,null)  --// place an object into the collection
        )
    );
    

    And use appropriate type names and the object. Poorly chosen and non standard naming conventions just add to the confusion.

  • Calling PropertyUtils.h functions return the error!

    Hello!

    I required the use of certain functions defined in the PropertyUtils.h class in the Photoshop SDK. I used the PIGetLayerName() function. I hoped that everything would be fine, instead an error was returned with the code 30901. I searched the internet, but have found no solution so far. Help, please! I use PS CS5 on Windows.

    Thank you!

    Hello

    I expect an answer to this question...! People, I don't know how to go about this problem... I wanted to know if we can find out if a particular layer is locked or not... The class propertyutils.h in question contains a method, which hopefully can solve my problem... The sound of the name of PIGetTargetLayerLock() with three Boolean parameters. Now, I don't know what type of values to pass to this function, because there is absolutely no info about... I get the same error I mentioned earlier--30901 (errPlugInPropertyUndefined)... Please help me... How to go to this topic... ??? Again, I want to know if we can know through code c ++ If a layer is locked or not...

    Thank you!

  • HP OfficeJet Pro 8600: Analysis of the function of the computer no longer works. Get the error "User name or password Incorrect"

    It was a sudden break in the analysis of network to the e-mail function.  I have rebooted my router, unplugged my printer, etc, and nothing solves the problem.  I don't know where he wants me to change a password that I often had to change my password on the computer and it has never caused a problem with the scanner before.  I tried all the things on this very topic messages that were a few years ago. The wireless printer works etc all work fine.  It's only the scan to my email is not working.  Help, please.

    Hello. No, it wasn't the problem, but I was able finally someone at HP support who managed to solve it. It's a configuration problem after an automatic update. Thanks for trying to help though!

Maybe you are looking for

  • Satellite C650D feeds are interchangeable?

    I have 2 portable satellite, a C650D with PSU N17908 (19v 3. 42A) & a L750 with a power of N179081 supply (3.95 A 19v). These power supplies are interchangeable between 2 laptops? or I would create a problem. The main difference seems to be the nomin

  • Can I downgrade Tecra S2 for Win2000?

    I recently bought a brand new Tecra S2 with preinstalled on WinXP. I tried it downgrade to Windows 2000, but the installer crashes when I press ENTER to start the installation. It is the same with Win98. Did anyone of you knows how to pass the operat

  • blue screen: Stop 0xED - unmountable boot volume

    Unable to restart from xp CD, can't get into the recovery console, does not start in safe mode.   0x000000ED (0x8A7CACD8, 0xC0000006, 0x00000000, 0x00000000) error code anyway to fix this?

  • Quit workiing APPCRASH/svchost.exe/Bucket ID: 1062082

    Signature of the problemProblem event name: APPCRASHApplication name: svchost.exeApplication version: 6.0.6001.18000Application timestamp: 47919291Fault Module name: xrwcscd.dllFault Module Version: 1.0.0.0Timestamp of Module error: 4549d2eaException

  • Windows Explorer crashes constantly on the new Asus

    I bought a new X53SV-SX288V Asus with windows 7 64 bit on it and after installing some programs Windows Explorer crashes constantly for some reason any... I have restored the pc to factory a couple of times now, hoping it might fix the problem, but i