Report Region SQL Source

Hello all...
Im new to Application Express so my problems are quite fundamental. I am trying to create a filter system on a report region that alters the SQL depending which field is selected and what criteria is entered. How do I refer to the SQL? I sthere a system name for the region source sql or or can I refer to a column name in the SQL by useing a variable?
i.e. ... WHERE <varColName> = <varSearchCriteria>
Many Thanks,
Richie

I am trying to do the same thing, and I am not finding the answer either in the howtos or your demos (which are great). I tried to follow the instructions below, but I don't have a "Query Definition" tab, I have a Report Definition tab and it does not contain a Join Conditions page.
Add a Condition
To add a condition to the DEMO_ORDER_ITEMS report:
1. Under Regions, select Order Items as shown in Figure 4-6.
Figure 4-6 Order Items
Description of Figure 4-6 follows
Description of "Figure 4-6 Order Items"
2. Click the Query Definition tab.
3. Click Modify Join Conditions.
4. On the Modify Join Conditions page:
1. For the first Column, select DEMO_ORDER_ITEMS.ORDER_ID. Note that you may need to click Search to view available columns.
2. In the second Column field, replace the existing text with the following condition:
:P2_ORDER_ID
5. Click Apply Changes.
Here is the Source of my Report - I am getting this error: "Invalid PL/SQL expression condition: ORA-06502: PL/SQL: numeric or value error"
select
"IDENTIFIER",
"APPLICATIONIDENTIFIER",
"QUESTIONNUMBER",
"ANSWERTEXT1",
"ANSWERTEXT2",
"ANSWERTEXT3"
from "#OWNER#"."COMPANYPERSONNEL"
WHERE "APPLICATIONIDENTIFIER" = :F101_APPLICATIONIDENTIFIER
AND "QUESTIONNUMBER" = 1
Appreciate any help. Thanks.
Note: I tried TO_NUMBER(:F101_APPLICATIONIDENTIFIER) - same result
Data Type for APPLICATIONIDENTIFIER = NUMBER(10)
Data Type for QUESTIONNUMBER = NUMBER(2)

Similar Messages

  • Apex 4.2 Report region sql query with "apex_item.text" renders wrongly

    In APEX 4.2 page i have created region "Report data".
    Type="SQl Query".
    "User Interface"-->"Template"="Reports Region".
    "Region Source"="select apex_item.text(1, '111') as c1 from dual".
    Actually the select query is little bit more complex, but generally simplified it is such, that it uses function "select apex_item.text" to construct HTML textfield.
    If i run in Sql Developer query
    select apex_item.text(1, '111') as c1 from dual;Then result is:
    <input type="text" name="f01" size="20" maxlength="2000" value="111"  />But in APEX 4.2 the report is rendered so:
    <td  headers="c1">&lt ;input type=&quot ;text&quot ; name=&quot;f01&quot; size=&quot;20&quot; maxlength=&quot;2000&quot; value=&quot;111&quot;  /&gt ;</td>(for this forum to display correctly i had to put extra spaces between" &gt" and ";" and so on)
    And APEX 4.2 shows ugly html inside report cell/slot for me, displaying characters/symbols ">". The reason is that APEX HTML page source does not have symbol ">" but has " &gt ;" .
    In APEX 3 i have similar query working well, without such anomaly.
    What attribute should i change in APEX 4.2 region to display my query result as needed?
    I need that function "apex_item.text", i cannot remove it.
    Edited by: CharlesRoos on 13.02.2013 15:28
    Edited by: CharlesRoos on 13.02.2013 15:29
    Edited by: CharlesRoos on 13.02.2013 15:29

    CharlesRoos wrote:
    In APEX 4.2 page i have created region "Report data".
    Type="SQl Query".
    "User Interface"-->"Template"="Reports Region".
    "Region Source"="select apex_item.text(1, '111') as c1 from dual".
    Actually the select query is little bit more complex, but generally simplified it is such, that it uses function "select apex_item.text" to construct HTML textfield.
    If i run in Sql Developer query
    select apex_item.text(1, '111') as c1 from dual;Then result is:
    <input type="text" name="f01" size="20" maxlength="2000" value="111"  />But in APEX 4.2 the report is rendered so:
    <td  headers="c1">&lt ;input type=&quot ;text&quot ; name="f01" size="20" maxlength="2000" value="111"  /&gt ;</td>(for this forum to display correctly i had to put extra spaces between" &gt" and ";" and so on)
    And APEX 4.2 shows ugly html inside report cell/slot for me, displaying characters/symbols ">". The reason is that APEX HTML page source does not have symbol ">" but has " &gt ;" .
    In APEX 3 i have similar query working well, without such anomaly.
    What attribute should i change in APEX 4.2 region to display my query result as needed?Ensure that the Display As Column Attribute for the C1 column is Standard Report Column.

  • How to replace a table name with an item value in report region SQL query?

    I've got a SQL query in a report region that goes like this:
    SELECT :P30_HIDDEN FROM v_dms_dataset
    GROUP BY :P30_HIDDEN
    P30_HIDDEN is populated from a textfield input. Why doesn't this work, and is there a way to achieve what I'm trying to do here? I really need the ability to dynamically generate SQL queries in this way.

    Ben - you could either:
    1. case when :P30_HIDDEN = 'COL1' then col1 else ... end
    in order to determine which column to select (only really useful if you have a small number of predetermined columns to select from), or
    2. generate the SQL dynamically.
    Set the report region to SQL Query (PL/SQL function body returning SQL query), then have something like:
    declare
    l_sql VARCHAR2(4000);
    begin
    l_sql := 'SELECT ' || :P30_HIDDEN || ' FROM v_dms_dataset
    GROUP BY ' || :P30_HIDDEN;
    return l_sql;
    exception
    etc.
    end;
    John.

  • Restricting the pl/sql error in report region(sql report)

    Hi,
    Is there any way to hiding pl/sql error in report region when we use generic column names*(Use Generic Column Names (parse query at runtime only)*
    ). and type is sql query else displaying alternative error message on that particular report region
    I am using apex 4.1 and 11g database
    Thanks
    Sagar.

    What kind of pl/sql error you are talking about?

  • Displaying previous page without running it's report region sql?

    Hi, I just created a button which is PREVIOUS and redirects to the previous URL. However I was hoping I could just display the previous pages report results again without re-running the report sql.
    The PREVIOUS button seems to re-run the sql ... is there any way of just caching the previous pages sql results and then they are instantly displayed from the next page by pressing the PREVIOUS button?
    Thanks

    Scott, this command works great. If you dont submit the current page it is fine. Is there a way to branch back to the previous page disregarding the current pages submissions as if you submit the current page then the command will only branch back to the same page but before it was submitted?
    Thanks

  • Layout issue: sql report region and items derived from a different table

    Hi all,
    I have a report region whose source is a sql query. I am trying to display other items in the same region(These I added manually on the page and they come from another table in the schema). It works fine, except the items that I added manually in the region always appear at the top of the items that are derived from the query. I want the other way around if possible, where I want the items from report query to appear first and then the other items to appear below them. Can this be done? If so how?
    Thanks in advance
    sr

    sr,
    on the definition page of your region, set the property "Display Point" to "Page Template Body (1. items below region content).
    I think that's what you are looking for.
    Patrick
    *** New *** Oracle APEX Essentials *** http://essentials.oracleapex.info/
    My Blog, APEX Builder Plugin, ApexLib Framework: http://www.oracleapex.info/

  • Error in editing a report region

    I have a report region (SQL Query PL/SQL function body returning SQL query).
    When I try to save the region source, I got the following error:
    1 error has occurred
    * Function returning SQL query: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the generic columns checkbox below the region source to proceed without parsing.
    (ORA-01403: no data found)
    Note that in the following region source, if I replace :P1_ITEM with 'One:Two:Three', I
    did not get any error when I saved the report:
    declare
    l_sql varchar2(32676);
    l_vc_arr2 HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    begin
    l_sql := 'select x, y '
    l_vc_arr2 := htmldb_util.string_to_table(:P1_ITEM);
    if l_vc_arr2(1) > 0 then
    l_sql := l_sql || ', z';
    end if;
    l_sql := l_sql || ' where x.c1=y.c1 '
    if l_vc_arr2(1) > 0 then
    l_sql := l_sql || ' and z.c1=x.c1 and z.c2 in (';
    l_sql := l_sql || l_vc_arr2(1);
    for t in 2..l_vc_arr2.count LOOP
    l_sql := l_sql || ',' || l_vc_arr2(t);
    END LOOP;
    l_sql := l_sql || ')';
    end if;
    l_sql := l_sql || ';';
    return l_sql;
    end;
    Can someone help?
    Thanks in advance.

    Try adding these two bold lines:
    declare
    l_sql varchar2(32676);
    l_vc_arr2 HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    begin
    l_sql := 'select x.c1, x.c3, y.c4 from x, y'
    l_vc_arr2 := htmldb_util.string_to_table(:P1_ITEM);
    IF l_vc_arr2.count() > 0 THEN
    if l_vc_arr2(1) > 0 then
    l_sql := l_sql || ', z';
    end if;
    l_sql := l_sql || ' where x.c1=y.c1 '
    if l_vc_arr2(1) > 0 then
    l_sql := l_sql || ' and z.c1=x.c1 and z.c2 in (';
    l_sql := l_sql || l_vc_arr2(1);
    for t in 2..l_vc_arr2.count LOOP
    l_sql := l_sql || ',' || l_vc_arr2(t);
    END LOOP;
    l_sql := l_sql || ')';
    end if;
    END IF;
    l_sql := l_sql || ';';
    return l_sql;
    end;
    Sergio

  • DA refresh 2 report regions

    Hello All,
    I have a DA that refreshes 2 report regions ( SQL query) . This works perfectly fine in 4.0.1.
    However when I import it to 4.0.2 , just one region refreshed while the other fails.
    Appreciate any guidance in figuring out the issue here
    Details of DA :
    Event : change
    Selection type : Item
    Item : hidden item whose value is used in where clause
    True Actions :
    1) Execute PLSQL to submit the hidden item
    2) Refresh report1
    3) Refresh report2
    APEX version : 4.0.2.00.07
    Thanks,
    RD
    Edited by: RD on Jan 16, 2012 4:45 PM

    Hi RD,
    you could use Firebug for Firefox (on the Console you will see the AJAX calls) or the Developer Toolbar of Google Chrome to check if all 3 AJAX calls are executed and what you get in the response. I think that should help you to track down why it's working on one machine but not on the other. Please also have a look at the actual response in the AJAX calls if it's useful data.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • PL/SQL Table use in report region query

    Hello,
    I have a package function which return pl/sql table. I want to create a report region based on this pl/sql table. Is it possible to do this kind of report in HTMLDB?
    Please guide me in this area.
    Thanks
    HA

    The htmldb_collections API (apec_collections in 2.2) is a very useful method for rendering reports and one I have used extensivly in the past.
    Once created and populated you can reference your collection as if it were a SQL table i.e.
    Select c001, c002, c003
    from htmldb_collections
    where collection_name = 'MY_COLLECTION';
    You can absolutly base an Apex Report region on collections. Just treat them as another table that you can select from, join to others etc.
    In order to utilise this you must do the following:
    1) Create your collection:
    note that collections only persist for the duration of your session and you can only see the data you inserted into the collection. Also I would create this collection as the Database user who owns the Apex Workspace
    htmldb_collection.create_or_truncate_collection ('MY_COLLECTION');
    2) Populate your collection:
    In your case I would set a loop construct that parses through your pl/sql table and assign all values as described below. I assumed that my_plsql_tab has 3 columns called Val1, Val2, Val3
    FOR x IN 1..my_plsql_tab.count
    LOOP
    htmldb_collection.add_member (p_collection_name => 'MY_COLLECTION',
    p_c001 => my_plsql_tab(x).val1,
    p_c002 => my_plsql_tab(x).val2,
    p_c003 => my_plsql_tab(x).val3
    END LOOP;
    Note that you can have upto 60 elements in your collection.
    3) Access your collection:
    Select c001, c002, c003
    from htmldb_collections
    where collection_name = 'MY_COLLECTION';
    This quesry can then form the source of your sql report region.
    Hope all that helps
    Duncan

  • Connecting a report region and a PL/SQL region

    Hi,
    I have created a report region whith pagination that only show 1 row at a time. I can then navigate backwards and forwards through this recordset. The first reportcolum in this recordset contains a number.
    I have also, on the same page, created a PL/SQL procedure region. What I want is to use the number from the SQL region as an input to the PL/SQL region. So when I navigate through the report (Using the pagination arrows), the PL/SQL region is in sync with the record I'm currently seeing in the report.
    Is this possible or do I have to try something different?
    Regards
    Trond

    Hi Trond,
    If you only want to show one record in your first region, it might be best to work with page items, retrieve one record at a time and use that data as the source for your page items. It's easier to implement and easier to reference those values in your second region. Reports are great if you have more then one record.
    Having said that, there are ways to implement it the way you outlined it in your posting. Granted it's not very elegant but it serves its purpose. You could write your own PL/SQL package, use this to set a global to the current row's primary key value and reference that global in your second region.
    Create your package as follows:
    create or replace package md_sample as
    g_pk_value number;
    function set_value(p_value number) return number;
    end;
    create or replace package body md_sample as
    function set_value(p_value in number) return number is
    begin
    g_pk_value := p_value;
    return 1;
    end;
    end;
    Now you need to make sure that your report calls this package appropriately. Calling this as part of your SQL statement won't work properly as it would also be called for records not currently shown on your page. A better way would be to use it for a PL/SQL expression within your report template definition. Pick a custom report template for your report and edit that template. Scroll down to the condition for the first column template and pick “Use Based on PL/SQL Expression”. Then type in the following expression (this is based on a select deptno, dname, loc from dept report):
    md_sample.set_value(#DEPTNO#)=1
    After that you'll be able to reference the global md_sample.g_pk_value. You could e.g. use this as the source for page items shown in your second region.
    Hope this helps,
    Marc

  • Conditional display in a SQL-Report/Report Region

    Hi,
    here I have an example for "Conditional display in a SQL-Report/Report Region". I figured it out in Firefox 3.6.2 using Firebug as development tool on Apex 3.2.1.00.12.
    First you have to put the following javascript code in the Page HTML-Header:
    <script type="text/javascript">
    <!--
    // SOURCE
    // W:\oracle\PRJ DWLS\javascript.07.js
    // Beispiel Funktion zur bedingten Formatierung einer Tabellenzelle.
    // Help (Substitution Strings):
    // http://htmldb.oracle.com/pls/otn/wwv_flow_help.show_help?p_lang=de&p_session=2412201185523196&p_flow_id=4003&p_step_id=420,4003
    // HTML Expression:
    // <script>ex_conditional_td('R094260001010', #ROWNUM#, #COLNUM#-1);</script>#DFT_COND1#
    function ex_conditional_td
    ( p_id
    , p_rownum
    , p_cellnum
      var l_td;
      l_td = vd_getColumn(p_id, p_rownum, p_cellnum);
      // hier die Bedingung definieren
      if (true) {
        l_td.style.color = '#808080';
    }  // -- eof ex_conditional_td -- //
    // Beispiel Funktion zum Abstellen der onMouse Funktionalität der Tabellenzeile
    // HTML Expression:
    // <script>ex_conditional_tr('R094260001010', #ROWNUM#);</script>#DFT_ID#"
    function ex_conditional_tr
    ( p_id
    , p_rownum
      var l_tr;    // TABLE.TR
      var l_td;    // TABLE.TR.TD
      if (true) {
        l_tr = vd_getRow(p_id, p_rownum);
        l_tr.onmouseover = null;
        l_tr.onmouseout  = null;
        for (var i=0; i<l_tr.cells.length; i++) {
          l_td = l_tr.cells;
    l_td.style.backgroundColor = '#DDDDDD';
    } // -- eof ex_conditional_tr() -- //
    var g_DEBUG = false;
    var g_TBODY = null;
    // Liefert das Body-Element der Tabelle mit der ID <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // Return
    // das Body-Element oder NULL, wenn die Zeile nicht gefunden wurde
    function vd_getBody
    ( p_id
    if (g_TBODY == null) {
    var l_table = null;
    l_table = document.getElementById( p_id );
    if (l_table == null) {
    l_table = document.getElementByName( p_id );
    if (l_table != null) {
    if (vd_debug()) {
    alert("Tabelle gefunden, " + l_table.nodeName);
    g_TBODY = vd_search( l_table, 'TD', 't10data', 'TBODY');
    return g_TBODY;
    } // -- eof vd_getBody() -- //
    // Liefert die Zeile <p_rownum> der HTML-Tabelle mit der Id <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // p_rownum - die Zeilennummer
    // Return
    // die Zeile oder NULL, wenn die Zeile nicht gefunden wurde
    function vd_getRow
    ( p_id
    , p_rownum
    var l_body = vd_getBody(p_id);
    if ( l_body != null
    && l_body.nodeName == 'TBODY'
    && l_body.children[p_rownum].nodeName == 'TR') {
    return l_body.children[p_rownum];
    else {
    return null;
    } // -- eof vd_getRow() -- //
    // Liefert die Spalte <p_column> der Zeile <p_rownum> der HTML-Tabelle mit der
    // Id <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // p_rownum - die Zeilennummer
    // p_column - der Index der Spalte / Zelle
    // Return
    // die Zelle oder NULL, wenn die Zelle nicht gefunden wurde
    function vd_getColumn
    ( p_id
    , p_rownum
    , p_column
    var l_tr = vd_getRow(p_id, p_rownum);
    if ( l_tr != null
    && l_tr.nodeName == 'TR'
    && l_tr.children.length >= p_column
    && l_tr.children[p_column].nodeName == 'TD') {
    return l_tr.children[p_column];
    else {
    return null;
    } // -- eof vd_getColumn() -- //
    // Rekursives Suchen nach einem Node.
    // Zweck: Das bedingte Formatieren einer Tabellenzelle in einem Apex Standard
    // SQL-Report.
    // Diese Funktion durchsucht rekursiv, ab einem Ausgangsknoten <p_node>, alle
    // darunter befindlichen Elemente, ob in dem Element <p_seachIn> sich die
    // Klasse <p_class> befindet.
    // Bei Standard-Reports ist die Reportzelle (TD) mit der Klasse
    // "t10data" formatiert.
    // Zunächst muss dazu die Tabellenzelle (TD) selbst, die übergeordnete
    // Tabellenzeile (TR), der Tabellenbody (TBODY) oder die Tabelle (TABLE)
    // selbst ermittelt werden.
    // Der Beispielaufruf:
    // var l_body;
    // var l_node = document.getElementById( 'R112233' );
    // l_body = search( l_node, 'TD', 't10data', 'TBODY');
    // durchsucht also das mit der Id "R112233" versehene Element [der Report, für
    // den in Apex eine statischen ID vergeben werden musste] rekursiv, bis er
    // die [erste] Tabellenzelle "TD" findet, die als Klasse "t10data"
    // definiert hat. Für diese ermittelt er dann das übergeordnete TBODY-Element.
    // Parameter
    // p_node - das Ausgangselement
    // p_searchIn - der Knotenname, der durchsucht werden soll
    // [node.nodeName == p_searchIn]
    // p_class - der Name der CSS Klasse
    // [node.classList[<index>] == p_class
    // p_parentName - der Name [node.parentNode.nodeName == p_parentName]
    // des Elements, das zurückgeliefert werden soll. Wird als
    // p_parentName der Suchname p_searchIn angegeben, wird
    // das Element selbst zurückgegeben.
    // Return
    // das per p_parentName gesuchte Element (TD, TR, TBODY, TABLE)
    function vd_search
    ( p_node
    , p_searchIn
    , p_class
    , p_parentName
    var LN = "vd_search";
    var l_element = null;
    // DEBUG
    if (vd_debug()) {
    alert(LN + ":" + "Untersuche " + p_node.nodeName + ", id=" + p_node.id);
    // 1) der aktuelle Knoten ist der, der durchsucht werden soll
    if (p_node.nodeName == p_searchIn) {
    if (p_node.classList.length > 0) {
    for(var c=0; c<p_node.classList.length; c++) {
    if (p_node.classList[c] == p_class) {
    // Parent Node dynmisch suchen
    l_node = p_node;
    if (l_node.nodeName == p_parentName) {
    return l_node;
    while(l_node != null && l_node.parentNode != null) {
    if (l_node.parentNode.nodeName == p_parentName) {
    return l_node.parentNode;
    else {
    l_node = l_node.parentNode;
    // 2) wenn nicht 1) oder nicht in 1) gefunden, dann in den Kindelementen
    // weitersuchen
    if (p_node.children.length > 0) {
    var i = 0;
    while (i<p_node.children.length && l_element==null) {
    l_element = vd_search( p_node.children[i], p_searchIn, p_class, p_parentName);
    i++;
    return l_element;
    } // -- eof vd_search() -- //
    // Gibt an, ob Debug ein- (true) oder ausgeschaltet (false) ist.
    // Return
    // true - debug ist eingeschaltet
    // false - debug ist ausgeschaltet
    function vd_debug()
    return g_DEBUG;
    -->
    </script>
    Maybe you have to modify the "vd_getBody" function. I'm searching the table cell with having the class "t10data". When you use another theme, there's maybe another class used.
    Second is, that you set an static id for your report region. I prefer this structure:
    R<app-id><page-id><seq> (Raaaaappppsss) e.g. R094260001010.
    First example is to turn off the onMouse-Effect. Maybe on the first or last column definition you put this code in the "HTML-Expression" area:
    <script>ex_conditional_tr('R094260001010', #ROWNUM#);</script>#ID#This will call the example function ex_conditional_tr with the parameter
    a) the region id
    b) the rownum (as oracle always starts with 1 this is the first data row [rownum=0 is the table header row])
    Second example is the conditional formatting of a table cell. Put this in the HML-Expression area:
    <script>ex_conditional_td('R094260001010', #ROWNUM#, #COLNUM#-1);</script>#ENAME#This will call the example function ex_conditional_tr with the parameter
    a) the region id
    b) the rownum
    c) the cellnum (here we have to subtract 1 to get the "real" cell index)
    The "ex_conditional" functions are just a representation of how to get the row or cell node.
    Hope this help a bit.
    Tom

    I would use a CASE statement in the select....
    each CASE would be an img src tag for a different button if the button is an image.
    does that make sense? I can include an example if you would like...

  • SQL-01403 error reported in a Report Region when there is data to display

    I have a report region populated by a PL/SQL function body returning a SQL Query. When the region is displayed, "ORA-01403: no data found" is output when there should be rows displayed on the report. I see a lot of postings related to ORA-01403, but none seem to describe why this problem occurs or how to solve it.
    Here is the generated SQL query:
    SELECT DISTINCT entry_type, active_time, expire_time, facility, via, output_remarks, p_reports.f_get_to_positions (entry_id, NULL) pos FROM (SELECT 'RSTN' entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_restriction_daily_all WHERE (entry_type in ('RSTN', 'APREQ', 'GS')) UNION ALL SELECT 'RSTN' entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_restriction_daily_all WHERE (entry_type in ('RSTN', 'APREQ', 'GS')) UNION ALL SELECT 'RSTN' entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_restriction_daily_all WHERE (entry_type in ('RSTN', 'APREQ', 'GS')) UNION ALL SELECT 'APERQ' entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_apreq_daily_all WHERE (entry_type IN ('APREQ', 'RSTN')) UNION ALL SELECT 'GS' entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_apreq_daily_all WHERE (entry_type IN ('GS', 'RSTN')) UNION ALL SELECT entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_edct_daily UNION ALL SELECT entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_runway_daily UNION ALL SELECT entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_deicing_daily UNION ALL SELECT entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_delay_daily UNION ALL SELECT entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_swap_daily UNION ALL SELECT entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_sua_daily UNION ALL SELECT entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_information_daily UNION ALL SELECT entry_type, active_time, expire_time, facility, via, output_remarks, entry_id FROM v_outage_daily ) WHERE (active_time BETWEEN TO_DATE (:G7_LOCAL_MIDNIGHT, 'YYYYMMDDHH24MI') AND TO_DATE (:G7_LOCAL_MIDNIGHT, 'YYYYMMDDHH24MI') + 1)
    I am using version 1.6.0.00.87.
    Please advise. Thanks.

    Create a summary column (lets say "CS_TotalRecords") at report level, and set the following properties:
    Function: Count
    Source: column which can not be null (if report displays some data)
    Reset At: Report
    Create a format trigger at most outer frame (the frame you want to hide and all object within that), and write following code:
    BEGIN
    IF NVL(:CS_TotalRecords,0) = 0 THEN
    RETURN (FALSE);
    END IF;
    RETURN (TRUE);
    END;
    Hope this helps.

  • SQL Query Too Large For Report Region

    Oracle Friends:
    I have a SQL query that is 24,000 characters long. APEX fails when I try to create a report using this query, probably because it is too long.
    I get an "ORA-01461: can bind a LONG value only for insert into a LONG column" after I paste it and try to go to the next page.
    Any ideas? I can't make my query any smaller without creating intermediate tables.
    Any help would be most appreciated.
    Regards,
    Rich Locus

    Hi,
    If possible, try to reduce the no. of characters from your SQL query. Ex. use shorter aliases etc in your query. Also, as suggested above, create some views which can form a part of your query and then use those views in your main query to reduce the total no. of characters.
    The report region source can take some limited no. of characters only. Exact figure is not known to me.
    Try the above suggestion and see if this works or not.
    Regards,
    Mangal

  • SQL Query (updateable report) Region - Conditionally Hide and Set Values

    SQL Query (updateable report) Region - Conditionally Hide and Set Values
    Outline of requirement :-
    Master / Detail page with Detail updated on same page using SQL Query (updateable report).
    The detail region has the following source
    SELECT item_id,
           contract_id,
           CASE WHEN hardware_id IS NOT NULL THEN
                   'HA'
                WHEN backup_dev_id IS NOT NULL THEN
                   'BD'
                WHEN hardware_os_id IS NOT NULL THEN
                   'HS'
           END item_type,
           hardware_id,
           backup_dev_id,
           hardware_os_id
    FROM   "#OWNER#".support_items
    WHERE  contract_id = :P26_CONTRACT_IDThe table support_items implements arced relationships and has the following columns
    CREATE TABLE SUPPORT_ITEMS
      ITEM_ID         NUMBER                        NOT NULL,
      CONTRACT_ID     NUMBER                        NOT NULL,
      HARDWARE_ID     NUMBER,
      BACKUP_DEV_ID   NUMBER,
      HARDWARE_OS_ID  NUMBER
    )A check type constaint on support_items ensures that only one of the fk's is present.
          (    hardware_id    IS NOT NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NOT NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NOT NULL
          )    Hardware_Id is a FK to Hardware_Assets
    Backup_dev_id is a FK to Backup_Devices
    Hardware_os_id is a FK to Hardware_op_systems
    The Tabular Form Element based on item_type column of SQL query is Displayed As Select List (based on LOV) referencing a named list of values which have the following properties
    Display Value     Return Value
    Hardware Asset    HA
    Backup Device     BD
    Computer System   HSThe Tabular Form Elements for the report attributes for hardware_id, backup_dev_id and hardware_os_id are all Displayed As Select List (Based on LOV).
    What I want to do is only display the Select List for the FK depending on the value of the Select List on Item Type, e.g.
    Item_Type is 'HA' then display Select List for hardware_id, do not display and set to NULL the Select Lists for backup_dev_id and hardware_os_id.
    Item_Type is 'BB' then display Select List for backup_dev_id, do not display and set to NULL the Select Lists for hardware_id and hardware_os_id.
    Item_Type is 'HS' then display Select List for hardware_os_id, do not display and set to NULL the Select Lists backup_dev_id and hardware_id.
    There are properties on elements to conditionally display it but how do we reference the values of the SQL query Updateable region? they are not given a page item name?
    Also on the Tabular For Elements there is an Edit tick against a report item - however when you go to the Column Attributes there is not a property with which you can control the Edit setting.
    What's the best way of implementing this requirement in APEX 3.1?
    Thanks.

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user13515136".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I have a multi-row region that displays values and allows entries in a number of fields.Provide exact details of how this has been implemented. (An example on apex.oracle.com is always a good way to do this.)
    I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done? Almost anything can be done, often in multiple ways. Which are appropriate may be dependent on a particular implementation, the skills available to implement it, and the effort you're willing to expend on it. Hence it's necessary to provide full details of what you've done so far...

  • Version 3.1 fault - ORA-06502 error when creating SQL Report Region/Page

    I usually perfect my query in SQL*PLUS before I create a new report region.
    Consequently, I copy the code into the region wizard to create the new page. However, since we have upgraded to Version 3.1, virtually every report I have tried to create has created the following error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    It would appear that a maximum of 960 characters can be used to create the region/page. Perversely, once the page/region has been created, I can then edit the source and include as much code as I want (so far I've not run up against a limit)
    As it's just annoying, but not stopping me doing what I wanted to do, I've not got around to mentioning this error previously, but it occurred to me that I should (so I am!)
    David

    Hi David,
    Thank you for reporting this. Unfortunately, this was a regression introduced in Application Express 3.1. The workaround is to edit the region, as you suggested. This has been filed as Bug 6956070 and will be corrected in the forthcoming Application Express 3.1.1 patch set.
    Joel

Maybe you are looking for