Problems of interactive report PL/SQL - current function or Collections

Hello

I have a report where I want either to limit the return by date or return the set. PL/SQL has not worked in the interactive report (is it available in 3.2?) then my second idea (2 reports, one for each option) didn't work as you can have more than one IR on a page. Looking here I found people of other leaders here for collections and here for common functions.

OK I finally got the thing of collections (did not know that "function_returning_query" would be replaced by your code) but I'm not sure, it can be used in my situation? I want it to be dependent on a LOV on the page with my code predicted as:
DECLARE
q VARCHAR2(30000);
BEGIN
q := 'select UPD_ID, PROJECT,DATABASE,REF,DESCRIP,STATUS,PERSON,
TO_CHAR(INS_DATE, ''HH24:MI DD-MON-YY'') AS INS_DATE
from TBL_ENV_LOG';
IF :P5_DAYS != 1337 THEN 
q := q || ' where TBL_ENV_LOG.INS_DATE >= TO_TIMESTAMP(SYSDATE - :P5_DAYS)';
END IF;
q := q || ' order by TBL_ENV_LOG.INS_DATE desc';
return(q);
END;
If the value of: P5_DAYS would need to go somehow, can it be passed as a parameter?
Is there another way to do this? A lot of hidden fields is boring :/

Edit: I've used a CASE statement for a column before, could I use it for all queries?

Mike

Published by: Gerd on October 14, 2009 10:45

This should however?

SELECT   UPD_ID,
         PROJECT,
         DATABASE,
         REF,
         DESCRIP,
         STATUS,
         PERSON,
         TO_CHAR (INS_DATE, 'HH24:MI DD-MON-YY') AS INS_DATE
FROM   "#OWNER#"."TBL_ENV_LOG"
WHERE   (TBL_ENV_LOG.INS_DATE >= TO_TIMESTAMP (SYSDATE - :P5_RAD)
         AND:P5_RAD != 1337)
OR (:P5_RAD = 1337)
ORDER BY   TBL_ENV_LOG.INS_DATE DESC;

(I have not checked this very well, but you get the idea)

See you soon

Ben

Tags: Database

Similar Questions

  • Passing ID as csv of an interactive report parameters in a function.

    Hello. I tried to add a checkbox in the first column in an interactive report and have tried to spend 'EMPNO' in the box. I tried this query.


    select apex_item.checkbox2(1,EMPNO,'CHECKED')" ",
            EMPNO,
           ENAME,
    CASE WHEN JOB='PRESIDENT' THEN
    'REMP PRES'
    WHEN JOB='MANAGER' THEN
    'REMPMANAGER'
    ELSE 'REMPOTHERS'
    END
           JOB,
           MGR,
           HIREDATE,
           SAL,
           COMM,
           DEPTNO
      from EMP
    

    Instead of boxes, I received a message on the screen in the first column as, < input type = "checkbox" name = "f01" value = "7839" CHECKED / >

    I also have a button "submit" on this page. When this button is clicked, I to call a (Javascript) function passing the EMPNO of the rows with checkbox enabled in the settings. The "EMPNO" parameter should be passed as CSV (if several check boxes are selected, I want to spend the EMPNO of all audited lines as parameters in a CSV file).


    I have reproduced the issue in oracle workspace.


    Workspace: XXKIRAN

    Username:[email protected]

    Password:kiran123

    App.No: 95253

    Page: 4


    Can someone help me on this please?

    Mencis Joe wrote:

    I also have a button "submit" on this page. When you click this button, I want to call a function (Javascript) which passes the EMPNO of lines with checkboxes checked in the settings. The 'EMPNO' parameter must be passed as CSV (if several check boxes are selected, I want to spend the EMPNO of all the lines that have been verified as parameters in a CSV file).

    Why CSV? The first thing that the function will probably do is to convert the string to an array...

    1. Add a static ID column of the box for use as a jQuery selector.

    2. place the Action defined by the dynamic ActionSubmit button.

    3. create a dynamic action:

    Event: Click

    Selection type: Button

    Button: Send

    Real Actions

    Action: Run the JavaScript Code

    Fire on Page load: NO.

    Code:

    var checkedIDs = $('td[headers="row-selector"] input:checked')
                      .map(function(){
                        return $(this).val();
                      })
                      .get()
                      .toString();
    
    // Call function passing checkedIDs as parameter
    
    alert('Checked IDs: ' + checkedIDs);
    
  • Problem of interactive report performance through data link

    Hi gurus,

    I have an interactive report that retrieves values from two joined tables, all two places on the same remote database. It takes 45 seconds to complete (refresh) a page after the issuance of a search. If I take the actual selection that is generated by the apex (the one with count (*) ()...) and run it from sql environment, it takes 1 or 2 seconds. What on Earth consumes the rest time and how to speed this up? I would like to awoid, create and maintain local if possible materialized views.

    Concerning
    SAMO

    Hello

    APEX should normally return the full result for the use of paging (where you put something in the sense to see the x - y of z), it changes, or the maximum number of lines can greatly affect performance.

    The site led indicator would need to refer in the name of the view, but can be a little finicky with that sort of thing. The suspicion of materialization only works for requests under weighted (in a ' WITH bla AS (SELECT / * + MATERIALIZE * / * FROM etc. etc.)). They tend to materialize in any case and its better not to use advice like this for production code unless there is absolutely no other choice, but just sub factoring without advice can often have a profound effect on performance. For example

    WITH a AS
    (
     SELECT c1,
            c2,
            c3,
            c4,
            c5
     FROM schema1.view1)
    , b AS
    (
     SELECT c1,
            c2,
            c3
     FROM schema1.view2)
    SELECT *
    FROM a, b
    WHERE a.c5 = b.c3
    

    Can produce a different plan or even just sub factoring one of the outside tables can have an effect.

    You need to try things here and experience and keep watching the execution plans. You must also replace fetch of row of toads to be all 9 to get a real idea of the performance.

    Let me know how you go.

    See you soon

    Ben
    http://www.munkyben.WordPress.com
    Don't forget to mark the answers useful or correct ;)

    Published by: Munky on September 29, 2009 13:41

  • Problem with interactive report

    Hi all

    I use Apex 4.2

    I have an interactive in which I activated the filtering and sorting.

    When I click on one of the column in the interactive report, saying: "LAST NAME", it shows me the filtering and sorting options drop down.

    The poster also available name drop extracted from the query, but it shows me some range of name pronounce A - C only.

    I have family with starting with another letter also names, but those names are not displayed.

    For some columns displays the values of A to E, but not the full list.

    How to display the entire list in this fall down.

    Kind regards

    Jean-Louis Patel.

    Hi Alice,.

    Because of interactive report performance, it loads only a few filters.

    If you change the column definition for the column, under set the Filter Type of column to one of the other options like 'User defined list of values to exact match filter' from the list of values.  You can then specify the query used to generate this list.  You could use something like what listed below to grab the first 20000 records.

    Select *.

    from (select name

    WCP

    em order by name)

    where rownum<=>

    But don't forget, it will always affect your performance of interactive report page.

    Or alternatively, you can use this link:

    http://tpetrus.blogspot.in/2012/05/interactive-report-filtering-in-apex.html

    -Sunil Bhatia

  • Interactive report gives ORA - 20001:error

    Hello

    I am reading a table of SQL Server and displays the output in the interactive report. SQL Server read via database public and connected to the database link Oracle via DG4MSQL. The error I get is:
    ORA-20001: get_dbms_sql_cursor error ORA-02070: SQL SERVER database does not COUNT in this context

    However when I run the same report as usual report it works fine.

    The SQL query behind the report is:
    SELECT * FROM TRANSP_COMP_V;
    The code behind the display is:
    CREATE OR REPLACE VIEW TRANSP_COMP_V AS
    (
    select 
    "Usr_Name",
    "Usr_Handle", 
    "BLoc", 
    "SLC_Hand"
    from ord.Req@sqlserver);
    Where @sqlserver is the link of public database to SQL Server 2008 R2.

    I tried the following:

    (1) used instead the name of each column * and got the same result
    (2) Rebult and respected the view several times. No problem during compilation
    (3) tested and ran the view independently and the SQL query in SQL Studio without any problem

    Is there any restriction on the interactive report during playback of the external data source (such as SQL Server through ODBC)? The error itself is confusing, as I'm not using COUNTY anywhere.

    Thank you very much.


    Using APEX 4.1.1 running in the Oracle Database 11 G R2 (windows x 64) (topic 23)

    It may be different depending on the style of the selected candidates paging - as long as total nbr of lines is not indicated, he might be allowed.
    APEX product managers may be able to describe some internal workings that explain why it does not work for an IR.

    It is one of the best examples out there for the pipeline functions. It's just a feeling - something I'll try, but I have not worked with external sources in a long time.
    http://www.Oracle-Developer.NET/display.php?ID=207

    Scott

  • Sort the results of interactive report in no data found message

    Hello

    I have an interactive report that returns results based on the: bind variable QUERY - I have a list of navigation on the side where all the elements to link to the current page with different values of request. The IR works fine until I try to sort the columns by clicking on the heading and selecting increasing / decreasing, how it returns no data available.

    It starts to work again if I change the last line of GOLD: REQUEST IS NOT NULL but this breaks the functionality of the report, I would like to return only selected articles or all if no query variable is present. I'm guessing that sort sets: ASK something temporarily and divides. My query is below, any ideas?
    SELECT   id,
             job_number,
             appt_start,
             domain,
             pwa,
             status,
             tstamp_created 
      FROM   fail_jobs 
      WHERE  (status = 'NEW' AND userid_created != 'SYSTEM' AND :REQUEST = 'ARD') 
         OR  (status = 'ATR' AND :REQUEST = 'ATR')
         OR  (status IN ('ERR','REV') AND :REQUEST = 'REV')
         OR  (status = 'COM' AND :REQUEST = 'COM')
         OR  (status IN ('PCD','PCA') AND :REQUEST = 'PCD')
         OR  :REQUEST IS NULL
    Thank you

    There are problems with interactive reports referencing known: DEMAND value, probably due to an internal logic that manages also simultaneously - potentially cause a malfunction or blockages.

    A workaround that I learned is to create a calculation to assign: APPLICATION to a temporary element (a PXX_REQUEST, for example) and reference it in the query, instead of: ASK. This has worked well for me in my experience.

    I would like to know if this helps - pls sign the thread as 'Useful' or 'Correct' if so, so more people can benefit.

    TKS,
    Kléber

  • Workaround solution for using PLSQL as a source of interactive report?

    Hi all!

    I have a PL/SQL anonymous block here, I wanted to use as the source for an interactive report. Only, I didn't know that interactive reports supported PL/SQL...
    For example, the code:
    DECLARE
    a_userid NUMBER;
    
    BEGIN
    SELECT userid
    INTO a_userid
    FROM users
    WHERE UPPER(username) = :APP_USER;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    a_userid := 0;
    
    IF a_userid = 0 THEN
    SELECT distinct a.name AS Foodname, a.foodid AS Foodid
    FROM food a 
    INNER JOIN foodunit c
    ON a.foodid = c.foodid
    WHERE a.foodlanguageid = :P18_LANGUAGE
    OR a.foodlanguageid = :P18_SET_LANGUAGE
    AND a.userid = 0
    ORDER BY a.name;
     
    ELSIF a_userid = :APP_USER THEN
    SELECT DISTINCT a.name AS Foodname, a.foodid AS Foodid
    FROM food a 
    INNER JOIN foodunit c
    ON a.foodid = c.foodid
    WHERE a.foodlanguageid = :P18_LANGUAGE
    OR a.foodlanguageid = :P18_SET_LANGUAGE
    AND a.userid = 0 
    AND a.userid = a_userid
    ORDER BY a.name;
    END IF;
    END;
    Of course this code will not work because I do not understand everything IN the statements, but just trying to understand what it is that I'm aiming.
    This code point is that when a user is not logged (and visits as a public user page), it must fetch the 'NAME' and 'FOODID"FOOD table lines. I added a column of this table (named USERID) and all rows having the value '0' for this column.
    Now, when a user logs on, he or she has a fixed username (registered in another table, named 'USERS'). A user is able to add foods that they own to the list.

    Of course, a visitor is not supposed to see all food products that have been added to the table by registered users. So, I wanted to show the separate data. Visitors (unregistered) only see the default values (all the lines in which the userid = 0) and registered users should see both added their own food (my username is 1, then I want to see all the lines where the userid = 1) and the rows with default values (where userid = 0).

    I found a way here:
    http://www.oracleapplicationexpress.com/tutorials/71-Oracle-Apex-interactive-report-based-on-PLSQL-function

    But it is not only makes sense to me. Y at - it is an easy way to explain how the tutorial in the link, or you know an easier way? Like making a procedure or something, or a function or a process page and somehow, refer to that in the SQL source interactive report?

    Any help is greatly appreciated.

    APEX version: 4.1.1.00.23

    Hi again,

    How does this request?

    SELECT DISTINCT a.name AS Foodname, a.foodid AS Foodid
      FROM food a INNER JOIN foodunit c ON a.foodid = c.foodid
     WHERE a.foodlanguageid IN (:P18_LANGUAGE, :P18_SET_LANGUAGE)
      AND (a.userid = :P18_USERID OR a.userid = 0)
    ORDER BY a.name
    
  • Interactive report - how to override tab saved report color by using page 0

    Is it possible to replace the color of a tab in report interactive report saved (the 'current' tag) by using page 0?

    I have tried the approach suggested in this thread:
    Re: change the background color of the interactive reports

    While the method works for the interactive report (.apexir_WORKSHEET_DATA tr td) table rows, I manage not implemented of the saved report interactive report tab (tab 'in progress'-# .apexir_REPORT_TABS span.current). I guess my syntax CSS isn't correct, but it looks like the CSS in the file .css on the originating server, so I don't know where I am going wrong.

    < style type = "text/css" >
    Works:
    .apexir_WORKSHEET_DATA tr td {background: blue; color: white ;};}
    does not work; also tried without the ' # ':
    span.current # .apexir_REPORT_TABS {background: blue; color: white ;};}
    < / style >

    Try this

    On Page 0 create a region and add this style
    
    

    Thank you
    Manish

  • Interactive report based on a Collection

    Hi guys

    Using Apex 3.2

    I have a classic report based on a collection, which works very well.
    I am now trying to create an interactive report based on the same query (collection), but no data is returned.
    I there something special I need to do an interactive report.

    See you soon


    Gus

    Hello Gus,

    First time when you create a report based on the collection ir, it does not include the columns in the display (don't know why)

    pls select the correct answer to help others

    Thank you

  • interactive report in APEX does not, because of the function "allowed to read.

    Hello

    I discovered that an interactive report does not work due to the permitted reading function.
    I have oracle 10.2.0.3 (database and analytical workspce Manager).
    I installed the overall sample to AWM.
    I've updated the spfile (setting an Always).

    In a query against the table of product_dim the APEX gives: no records found. In SqlPlus or SqlDeveloper returns 36 lines.

    At the TOP, I installed a workspace on the overall scheme.

    I read on the read function, effective for the product_dim table permits.

    How to solve this problem: paying (and how) the APEX and the environment, of removing permission read function?
    Or removing the IsInvisible column?

    Where is this feature?

    Any response will be appreciated.

    Leo

    Can you post the SQL, you use by APEX?

    Try using this:

    SELECT... from table (OLAP_TABLE(' GLOBAL.) An OVERALL duration session '

    Thank you
    Brijesh

    Published by: Brijesh Gerard on October 28, 2009 15:53

  • Problem with calculation on update interactive report

    Apex 3.2

    I have an interactive report, that is editable, and the functions of grand.
    My problem is when users try the function of calculation on 2 columns, we get the
    "ORA-01722: invalid number."
    My report is generated using apex_item
    The code in the first column is
    eoline.plannedqty PLANNEDQTY
    second column depends on the CASE, so it's either
    APEX_ITEM.DISPLAY_AND_SAVE(2,eoline.orderqty)
    or
    APEX_ITEM.TEXT(2,eoline.orderqty,5,10,'style="text-align:right;" onchange="show(this);"')
    I tried to_char, to_number, but can't make it work.

    I missed something obvious

    Gus

    In other words:

    SELECT 1 + APEX_ITEM.DISPLAY_AND_SAVE(2,2)
    from dual
    

    Yields:

    ORA-01722: invalid number

    Why?

    SELECT APEX_ITEM.DISPLAY_AND_SAVE(2,2)
    from dual
    

    Yields:

    2
    

    Of course, on your screen, all you see is a number in a text box, but you're still emitting of HTML code. You can not expect from the Apex to handle this. The calculations just perform calculation asked on the values of your defined columns.

    Solution? Turn off calculations in your issuing html columns because it does not work like that.

  • Conditional display of interactive report based on the different SQL query

    Hello

    I have two drop-down list at the top of my page and below I have an interactive report.
    Based on the selection of the user from the drop-down list values, interactive report should change based on different SQL queries.

    Is it possible to have different SQL queries based on the drop-down list values and generate interactive report based on that?

    Thank you

    Hello

    You can't have IR based on function returning the query as you can have classic report

    But here is a workaround
    http://www.oracleapplicationexpress.com/tutorials/71

    Kind regards
    Jari

  • The interactive report update and problem of Plugin JQuery

    Hello


    I have interactive report in my page. So I use the plugin jQuery context menu when user right click on a column he get an option to add, delete, update and another option.
    javascript pseude code for context menu
    $(function(){
         context_menu();
    });
    
    function context_menu(){
    
      $('.Col1').contextMenu();
    }
    Suppose the user selects Delete option. In this case jQuery popup appears and users enter data that are saved in the table by using the application process. After you use gReport.search ('SEARCH'), I refresh the page...

    Now the question - now when I right click on the column of my jQuery context menu does not work...


    Used workaround solution - I've added onmouseover = context_menu () function for the column... link and it works fine...


    Now my question is... whenever the user moves the mouse over the column, it will run function context_menu()... There will be no unwanted problem... or memory leak problem...

    Please advice...


    Thank you
    shijesh

    Hello

    Okay, that's good.
    But if you take this plugin to use to select the option group you also code of loan that trigger events on IR Ajax calls.

    Kind regards
    Jari

  • Interactive reporting stored procedure Oracle SQL to return

    I have the type of region of next report:

    Type of report of area:
    SQL query (body of function from PL/SQL returning SQL query)

    Source of the region:

    DECLARE
    q varchar2 (4000);
    BEGIN
    GetMySQLString (: P22715_SID, q);
    Return to q;
    END;


    function GetMySQLString() return varchar2 is
    Start
    return ' select * from myTable ";

    end GetMySQLString;





    For some reason though I can't figure out how to work with an interactive report... Basically I want the report to use the SQL returned by the Oracle stored function...

    Any thoughts?

    Should have sought better!

    Guess this should help: procedure call or an interactive report function

    Published by: tward on 3 Sep, 2010 08:55

  • Interactive report filter problem

    Hello

    Today I met a problem with an interactive report. When the report first, load no problem. If a filter is added, an error is returned. The error is actually produced by a routine of affirmation that triggers and exception if a NULL value is passed. Here is a modified and simplified the application version:
    SELECT id,
       name,
       dept,
       emp.year_of_emp(hire_date) AS years_of_employment
    FROM emp_table
    WHERE id IN (
       SELECT c001
       FROM apex_collections
       WHERE collection_name = 'EMPS_UNDER_MANAGER'
    );
    Once again, when the report first no loading, no problem. When the Manager applies, say a filter on dept, an error is raised by the emp.year_of_emp function because a NULL value was passed.

    I know that all the EMOS with an id of PGE in the collection have a hire_date so I don't think that I should add another condition in where clause to filter those (even if it's the work at this stage). Anyone has any ideas as to what could be the cause?

    Kind regards
    Dan

    http://danielmcghan.us
    http://sourceforge.NET/projects/tapigen
    http://sourceforge.NET/projects/plrecur

    Hello Dan,.

    Most points on the road ;-)

    Select / * + SORTED * / seems to do the trick... (I've updated your sample app and it works)

    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this response in marking it as useful or Correct ;-)

Maybe you are looking for