Trying to add a where clause.

Hi All,
I am not much aware of View Links.
I am trying to extend a particular Page.
The page has an Hgrid, which looks like (Headers -> under that section data of that header -> under it attributes data of that section)
Header
Section
Attributes
There is a view link between "Headers - Section" & another between "Section - Attributes".
I want to add a filter at the Sections level. So I added a where clause to the sections VO. But the where clause is not taking any affect. So I wanted to know if this is because of the view link.
Please Help !
Regards,
Bm

Did you mean something like this,
i have tried the below code in forms 10g , as the where clause of 'EMP' block there was no problem.
deptno in (select /*+ ORDERED */ deptno from dept where rownum<2);
Also tried in SQLPlus like below
SQL> select * from emp where deptno in (select /*+ ORDERED */ deptno from dept where rownum<2);
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7839 KING PRESIDENT 17-NOV-81 5000 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10

Similar Messages

  • How can you add a where clause using "OR" with applied ViewCriteria?

    [JDeveloper 10.1.3 SU4]
    [JHeadstart 10.1.3 build 78]
    I am using JHeadstart, but have a question probably more in the ADF area. On the JHeadstart forum I asked:
    "I am overriding JhsApplicationModule's advancedSearch in order to be able to search in childtables. I created transient attributes, display those in advanced search and in the overridden method I check if any of these are filled by the user and create a where clause like 'EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>)'. I add this whereclause using ViewObject.setWhereClause.
    So far so good and it works. However, if the user selects 'Result matches any criteria', combining setWhereClause and the normal advancedSearch QueryByExample implementation using ViewCriteriaRow do not provide the desired result, since the ViewCriteria and the setWhereClause are AND-ed together, which is fine if the user selects the (default) "Results match all criteria" (everything is AND-ed) but not the "Result matches any criteria", since then every criterium is OR-ed together, except for the setwhereclause criteria and the set of ViewCriteriaRows, they are AND-ed.
    I looked if I could specify that a WhereClause will be OR-ed to existing applied ViewCriteria, but no luck. Do I have to rewrite also advancedSearch's ViewCriteria implementation and write an entire setWhereClause implementation to be able to "OR" every criterium? Or any other suggestions? Can I look at the entire Where clause and rewrite it (after applyCriteria and setWhereClause are called on the VO)?
    Toine"
    Sandra Muller (JHeadstart Team) told me today: "This sounds like a JDeveloper/ADF issue that is not related to JHeadstart. The question is: how can you add a where clause using "OR" if there are already one or more ViewCriteria applied?
    To simplify the test case, you could create a simple ADF BC test client class in a test Model project without JHeadstart (in the test class, use bc4jclient + Ctrl-Enter), in which you first apply a few ViewCriteriaRows to a View Object and also add a where clause.
    Can you please log a TAR at MetaLink ( http://metalink.oracle.com/ ), or ask this question at the JDeveloper forum at http://otn.oracle.com/discussionforums/jdev.html ? (This what I am doing now ;-))
    Thanks,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting"
    Anyone knowing the answer or am I asking for an enhancement?
    Toine

    Hi,
    Can you SET your whereclause as follows ?
    ('Y' = <isAnd>
    and EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>))
    OR ('N' = <isAnd>
    AND EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> OR <another column in childtable> LIKE '<value supplied by user>))
    )

  • Trying to use a where clause from a table

    hi,
    I have a report and I need to use a where clause that is archived in a table, it is a different one depending on the row (colour=blue or number = 88..) I have tryied with ref cursor, dinamis sql, functions, packages and could not get it, any suggestion??
    thanks

    You may use Lexical Rerefences: "Lexical references are placeholders for text that you embed in a SELECT statement. You can use lexical references to replace the clauses appearing after SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, CONNECT BY, and START WITH....."

  • Using a WHERE clause in APEX Tree

    Hi All -
    I have an hierarchical SQL query that I'm displaying as an APEX tree.
    My sample app is here:
    https://apex.oracle.com/pls/apex/f?p=32581:29
    login: guest
    pw: app_1000
    workspace: leppard
    I am trying to add a WHERE clause so that only nodes with the lowest level children are displayed, i.e. something like 'WHERE connect_by_isleaf = 0 OR level = 5'
    The tree query with the where clause works fine in the SQL commands window, but when I add the WHERE clause to my apex tree the page no longer displays anything. Is this an issue with APEX or is there some other way to filter my results?
    Thanks in advance for any suggestions,
    john

    Connect by occurs first, the where clause then is applied to those results, effectively cutting away in the hierarchical structure. Since apex has to build a hierarchical structure from the query it relies on the level pseudocolumn, which is butchered by applying the where clause. It's a miracle you aren't even receiving errors because I'd almost expect an incorrect json array to have been built. With no top level to start from and only level 5 or leaf nodes there is no structure to present: both apex can not put out a correct representation and not jstree either. In your query you will see your "root nodes" but it is not representable.
    I'm not sure why you want to present this in a tree? Both connect_by_is_leaf and level = 5 will simply give you a list of nodes without any hierarchical structure.
    The better thing to do is to use a subquery to first limit your dataset and then use that to base the tree query on, that way you don't break any of those vital columns.
    Eg if you only want leaf nodes and their immediate parent you could go for something like this (quick mockup on some testdata):
    with dataset as (
    select node_id, parent_id
       from treedata
      where connect_by_isleaf = 0
    connect by prior node_id = parent_id
      start with parent_id = 0
    dataset2 as (
    select node_id, parent_id
      from dataset
    union all
    select node_id, null parent_id
      from treedata
    where node_id in (select parent_id from dataset)
    select level, node_id
       from dataset2
    connect by prior node_id = parent_id
      start with parent_id is null

  • Where Clause in Table Lookups for Data Load

    Hello,
    In Shared Components I created in Data Load Table. In this Data Load Table I added a Table Lookup. On the page to edit the Table Lookup, there is a field called Where Clause. I tried to add a Where Clause to my Table Lookup in this field but it seems that it has no effect on the Data Load process.
    Does someone know how to use this Where Clause field?
    Thanks,
    Seb

    Hi,
    I'm having the same problem with the where clause being ignored in the table lookup, is this a bug and if so is there a work around?
    Thanks in advance

  • Why tree query can't take where clause

    I build a tree struncture without where clause , it is fine, but When I tried to add a where clause, I get error, (Warning: Tree root ID "1" not found. ). Does anybody know why?
    Here is my SQL
    select "ID" id,
    "PID" pid,
    "NAME" name,
    "LINK" link
    from CAPACITY_TREE
    where branch='CAP'
    order by 3

    Hi,
    I'm having a similar problem in APEX 3.01. If you try to create a try using the following query you get the: Warning: Tree root ID "7839" not found error, where 7839 is the "KING" id empno
    WITH x AS
         (SELECT "EMPNO" ID,
                 "MGR" pid,
                 "ENAME" NAME,
                 NULL LINK,
                 NULL a1,
                 NULL a2
          FROM   "EMP"
          where ename = 'JONES')
    SELECT x.id, x.pid, x.name, x.link, x.a1, x.a2
    FROM   xAny ideas as to why we can't put a where clause in a tree?

  • How to add a dynamic where clause for a sql based VO with group by query?

    Hi,
    Here is my case, I have a sql query based VO with the query like "select status, count(*) StatusCount from my_table group by status". Now I used the following java code trying to dynamically add the where clause to my VO to filter the rows based the type attribute in my DB table.
    vo.setWhereClause("type='MyType1' ");
    vo.executeQuery();
    Then I got the sql syntax error. Looks like the ADF has added the where clause to the end of my sql so my sql becomes "select status, count(*) StatusCount from my_table group by status where type='MyType1' ". But what I expected was the correct syntax "select status, count(*) StatusCount from my_table where type='MyType1' group by status".
    Does anyone know if this is an ADF bug? Or is there any other way to achieve my goal?
    Thanks,
    Chunyang
    Edited by: Chunyang on Dec 13, 2012 9:09 PM

    Hi,
    When you use setWhereClause on the VO, it is applied on top of the VO query. I.e, assume your VO has the following query.
    select empno, ename from empNow, if you apply the where clause programatically, only the two attributes that you are using in the select statement could be used. I.e
    select * from (select empno, ename from emp) where ename='KING' - VALID
    select * from (select empno, ename from emp) where deptno=10  - INVALID (because the inner query - the one you've defined as query for your vo does not have deptno attribute selected)If you would need to set a dynamic where clause, you need to make them available in your select statement / use bind variables.
    -Arun

  • How to create a procedure to output REF CURSOR with any WHERE clause?

    I have an requirement like this: I have huge query which need to reuse in my code more than 10 times. This SQL has about 50 lines. Thing is for those 10 odd times sometimes the WHERE clause changes (columns are the same). So I cannot create a view since SQL is not static.
    I thought of writing a procedure with a WHERE_CLAUSE input para. I output a sys refcursor by adding the where clause. But I can't do it since you cannot add a where clause like that.
    i.e.
    PROCEDURE dynamyic_query (p_where_clause IN VARCHAR2, p_out_query OUT SYS_REFCURSOR ) IS
    BEGIN
      OPEN p_out_query FOR SELECT ......... FROM table WHERE || ' ' || p_where_clause;
    END;The above gives error.
    How to handle a situation like this???? Any help would be greatly appreciated.

    I tried this method:
    I created a table tab_test which has these records:
    TNAME                          TABTYPE    CLUSTERID                                                                                                                                                                  
    ABS_V4_P_ERROR_MESSAGES        TABLE                                                                                                                                                                                  
    ABS_V4_P_ORG_PARAM             TABLE                                                                                                                                                                                  
    ABS_V4_P_PARAMETER             TABLE                                                                                                                                                                                  
    ABS_V4_P_SYS_PARAM             TABLE                                                                                                                                                                                  
    ACCINTERFACE_PARAMETERS        TABLE                                                                                                                                                                                  
    ACCOUNTS                       TABLE                                                                                                                                                                                  
    ACCOUNT_EXTRACT_PERIODS        TABLE                                                                                                                                                                                  
    ACCOUNT_EXTRACT_PERIODS#       TABLE                                                                                                                                                                                  
    ACCOUNT_EXTRACT_PERIODS_1      TABLE                                                                                                                                                                                   Now I create this proc:
    PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS
      v_stmt VARCHAR2(1000);
    BEGIN
      v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND tabtype = :x';
      OPEN p_out_cursor FOR v_stmt using p_where_cluase;
    END;I create this code block and run it:
    declare
      v_tname varchar2(200);
      out_cursor sys_refcursor;
    begin
      forms_text_dyn_sql_test('TABLE', out_cursor );
      LOOP
        fetch out_cursor INTO v_tname;
        exit when out_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(v_tname);
      END LOOP;
    end;
    /I get correct output:
    ABS_V4_P_ERROR_MESSAGES
    ABS_V4_P_ORG_PARAM
    ABS_V4_P_PARAMETER
    ABS_V4_P_SYS_PARAMHowever, when I change the proc like this:
    PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS
      v_stmt VARCHAR2(1000);
    BEGIN
      v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND :y';
      OPEN p_out_cursor FOR v_stmt using p_where_cluase;
    END;And run this code block:
    declare
      v_tname varchar2(200);
      out_cursor sys_refcursor;
    begin
      forms_text_dyn_sql_test(' 1 = 1 ', out_cursor );
      LOOP
        fetch out_cursor INTO v_tname;
        exit when out_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(v_tname);
      END LOOP;
    end;
    /I get error:
    [1]: (Error): ORA-00920: invalid relational operator ORA-06512: at "ABS.FORMS_TEXT_DYN_SQL_TEST", line 6 ORA-06512: at line 5Looks like you can only put column_name = :z, column_name = :y type values. You cannot it seems replace it with any WHERE CLAUSE????

  • Creating WHERE clause for an outer join using DatabaseFilter

    Hi all,
    I read a post on thie group about constructing the WHERE clause for a RowSet Controls
    SQL Query using the DatabaseFilter and this is what it said:
    ****************************************************************************The
    following example shows adding part of a WHERE clause in an action method of a
    page flow:
    DatabaseFilter.FilterTerm term = new DatabaseFilter.FilterTerm(); term.sColumnName
    = "name"; term.op = DatabaseFilter.opContains; // there are ops for equals, less
    than, etc... term.value = form.getPartialName();
    // You can also add sort terms for an ORDER BY clause allNames = dbControl.getNames(new
    DatabaseFilter(new DatabaseFilter.FilterTerm[] {term}, null));
    I am trying to create a where clause which uses a join like this:
    Select * from x,y where x.id=y.id (+)
    ie. All values from x.id but only corrosponding ones from y.id.
    Is there any way to build this outer join query using the DatabaseFilter class
    or am i forced to use a String which is contruct in my page flow as the where
    clause?like so:
    * @jc:sql command-type="grid"
    * rowset-name="RFPSRowSet"
    * max-rows="1000"
    * statement::
    * SELECT RFPS.RFP_ID,RFPS.NAME AS RFP_NAME,RFPS.FFO_NUMBER,RFPS.RFP_TYPE,RFPS.CFDA_NUMBER,COMPETITIONS.NAME
    AS COMP_NAME,COMPETITIONS.COMPETITION_ID FROM RFPS,COMPETITIONS WHERE {sql: whereClause
    } {sql: filter.getOrderByClause ()}
    public RowSet getAllRfps(java.lang.String whereClause,DatabaseFilter filter)
    throws SQLException;
    and in my pageFlow action, i do the following:
    StringBuffer whereClause= new StringBuffer();
    whereClause.append("RFPS.RFP_ID = COMPETITIONS.RFP_ID (+)");
    if ((form.getRfpTitle() != null) &&
    (!form.getRfpTitle().equalsIgnoreCase("")))
    whereClause.append(" AND UPPER(RFPS.NAME) LIKE %"+form.getRfpTitle().toUpperCase());
    if ((form.getCfdaNumber() != null) &&
    (!form.getCfdaNumber().equalsIgnoreCase("")))
    whereClause.append(" AND RFPS.CFDA_NUMBER ="+form.getCfdaNumber());
    if ((form.getFfoNumber() != null) &&
    (!form.getFfoNumber().equalsIgnoreCase("")))
    whereClause.append(" AND RFPS.FFO_NUMBER ="+form.getFfoNumber());
    sortFilterService = SortFilterService.getInstance(getRequest());
    DatabaseFilter filter=sortFilterService.getDatabaseFilter(getGridName());
    log.debug("***********"+whereClause.toString()+"***********");
    allRows = searchRfaAndComp.getAllRfps(whereClause.toString(),filter);
    Thanks in advance for your help,
    Regards,
    Vik.

    Thanks for your reply. Just one more question....if we indeed are trying to use
    a simple query and have a where clause like "select * from x where upper(x) like
    {x}", how do we set the UPPER filter on the column using the database filter?
    I see a IDENTIFIER.ISUPPER static field on that DatabaseFilter but am unsure how
    to use it. Would appreciate any pointers .
    Thanks again,
    Vik
    Eddie O'Neil <[email protected]> wrote:
    Vik--
    I believe that the approach that you describe below is the best one
    for dealing with outer joins
    with the DatabaseFilter.
    Apologies for the limitation...
    Eddie
    vik wrote:
    Hi all,
    I read a post on thie group about constructing the WHERE clause fora RowSet Controls
    SQL Query using the DatabaseFilter and this is what it said:
    ****************************************************************************The
    following example shows adding part of a WHERE clause in an actionmethod of a
    page flow:
    DatabaseFilter.FilterTerm term = new DatabaseFilter.FilterTerm(); term.sColumnName
    = "name"; term.op = DatabaseFilter.opContains; // there are ops forequals, less
    than, etc... term.value = form.getPartialName();
    // You can also add sort terms for an ORDER BY clause allNames = dbControl.getNames(new
    DatabaseFilter(new DatabaseFilter.FilterTerm[] {term}, null));
    I am trying to create a where clause which uses a join like this:
    Select * from x,y where x.id=y.id (+)
    ie. All values from x.id but only corrosponding ones from y.id.
    Is there any way to build this outer join query using the DatabaseFilterclass
    or am i forced to use a String which is contruct in my page flow asthe where
    clause?like so:
    * @jc:sql command-type="grid"
    * rowset-name="RFPSRowSet"
    * max-rows="1000"
    * statement::
    * SELECT RFPS.RFP_ID,RFPS.NAME AS RFP_NAME,RFPS.FFO_NUMBER,RFPS.RFP_TYPE,RFPS.CFDA_NUMBER,COMPETITIONS.NAME
    AS COMP_NAME,COMPETITIONS.COMPETITION_ID FROM RFPS,COMPETITIONS WHERE{sql: whereClause
    sql: filter.getOrderByClause ()}* ::
    public RowSet getAllRfps(java.lang.String whereClause,DatabaseFilter
    filter)
    throws SQLException;
    and in my pageFlow action, i do the following:
    StringBuffer whereClause= new StringBuffer();
    whereClause.append("RFPS.RFP_ID = COMPETITIONS.RFP_ID (+)");
    if ((form.getRfpTitle() != null) &&
    (!form.getRfpTitle().equalsIgnoreCase("")))
    whereClause.append(" AND UPPER(RFPS.NAME) LIKE %"+form.getRfpTitle().toUpperCase());
    if ((form.getCfdaNumber() != null) &&
    (!form.getCfdaNumber().equalsIgnoreCase("")))
    whereClause.append(" AND RFPS.CFDA_NUMBER ="+form.getCfdaNumber());
    if ((form.getFfoNumber() != null) &&
    (!form.getFfoNumber().equalsIgnoreCase("")))
    whereClause.append(" AND RFPS.FFO_NUMBER ="+form.getFfoNumber());
    sortFilterService = SortFilterService.getInstance(getRequest());
    DatabaseFilter filter=sortFilterService.getDatabaseFilter(getGridName());
    log.debug("***********"+whereClause.toString()+"***********");
    allRows = searchRfaAndComp.getAllRfps(whereClause.toString(),filter);
    Thanks in advance for your help,
    Regards,
    Vik.

  • Sub query in where clause

    I have the following code which keeps throwing an error:
    select distinct game_code, count(player_id)
    from customer_data.cd_nhl_gm_tender_stats t
    where 
    (select distinct player_id
    from customer_data.cd_nhl_gm_tender_stats
    where season_id = 200818)
    group by game_code, player_id
    having count(player_id) > 1Error states that there's a missing expression right before the group by, any thoughts?
    The subquery is basically used to find a unique player_id value, (so there's no duplicates rows in the result set.)
    Sample data;
    customer_data.cd_nhl_gm_tender_stats t
    Game_code player_id
    88484           545454
    88484           545454
    88484           545454There's obviously other columns in the table above, but ultimatly there is mutliple rows for each game.
    I'm just trying to return each game_code where more then one player_id is found.

    Michaels2 i'm not sure your code is doing quite what i need
    select   *
      from   (select   t.*,
                       count (distinct player_id) over (partition by game_code) cnt
                from   cd_nhl_gm_tender_stats t where season_id = 200818)
    where   cnt > 1The subquery in the from clause is just selecting every game_code where season_id 200818 and then you add a where clause where cnt > 1 in the main query(whcih doesn't accomplish what I really wanted). What I need is the count of distinct player_id where season_id = 200818 AND cnt of (distinct player_id) over (partition by game_code) cnt > 2**. The issue i'm having is, that i'm not quite sure how to format the code to get these results.
    To clairfy what i need one more time ( i didn't explain things well in my original post)...
    I want each game_code where a player_id count is greather then two. And as stated earlier the gm_tender_stats table has numerous entries with the same player_id for the same_game code, which is why this makes writing this query a little more difficult.
    Edited by: user652714 on May 11, 2009 7:52 AM

  • Where clause in VO

    Hi,
    I am trying to implement a where clause in the VO. I followed the steps but getting an error. My questions is, before executing the query, how to know the exact SQL statement which is going to get processed after we pass parameters using whereclauseparam?
    One more question which i would like to ask you guys. In the Select statement which we use in a VO, at runtime we need to add a where clause. So in this whereclause, the column names which we use are the actual database column names or the names which the VO displays in the ViewObject?
    Thank you

    Hi,
    An Example for you and I hope it clear your doubts.:--
    Method in Method to Your EmployeeFullVOImpl Class
    import oracle.jbo.domain.Number;
    import oracle.apps.fnd.framework.OAException;
    public void initQuery(String employeeNumber)
    if ((employeeNumber != null) &&
    (!("".equals(employeeNumber.trim()))))
    // Do the following conversion for type consistency.
    Number empNum = null;
    try
    empNum = new Number(employeeNumber);
    catch(Exception e)
    throw new OAException("AK", "FWK_TBX_INVALID_EMP_NUMBER");
    setWhereClause("EMPLOYEE_ID = :1"); // TABLE COLUMN
    setWhereClauseParams(null); // Always reset
    setWhereClauseParam(0, empNum);
    executeQuery();
    } // end initQuery()
    You can get the sql query in Jdev itself & also get information like about the bind variable which set at run time ==>
    Lets say, for this exercise, I wish to find the exact piece of SQL Statement that my screen fires, when doing an update.
    In order to do so, we can append text -Djbo.debugoutput=console to runner property As shown below, I can enter the following text in Runner property of jDeveloper.
    For more details go to this link dear.
    http://oracle.anilpassi.com/debugging-oa-framework-7-different-techniques-2.html
    For more details about setting VO attribute at runtime go to jdevdoc/WebHelp/toolbox/toolbox.htm. Exercise: Drilldown to Details Page
    I hope i answered all your questions.
    Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Incorrect Where Clause being set in Master Block

    I got a strange error the other day. I have 2 database blocks in a form and the blocks are based on views. So, lets say Block1 is based on View1 and Block2 is based on View2. Block1 and Block2 are also in a Master Detail relationship. So, Block B1 is the Master and Block B2 is the Child.
    So, our error routine captures the last query that was run by doing a :SYSTEM.LAST_QUERY. What was interesting was that a user got Error FRM-40505 which basically means "ORACLE error: unable to perform query".
    Looking at the Last Query, it basically tried to get the WHERE Clause from the View2 instead of the View1 in which case there was a problem Querying that block and thus getting Error 40505.
    The where clause that is being created is actually coming from the where clause of View2 which has been set up in the Property Sheet value.
    Am not putting any code here for now but if that helps, I can put some code in there.
    Any help is appreciated.

    If you are executing a query from one of your own buttons or some other programmatic manner be sure focus is in the master block. Remember that if you are clicking on a button, focus is moved to the button. In this case, your first line of code in the button should be something like GO_BLOCK('MY_MASTER_BLOCK')
    If that doesn't help, I would recommend creating a new form. Use the Data-block and Layout Wizards to create the master block then the detail block. Allow the Wizard to create all the code needed for the relationship. Once this relationship has been created, manually create a new block. Be sure that the new block is positioned below your first two blocks. In other words:
    + Data Blocks
    ...+ master_block
    ...+ detail_block
    ...+ my_block
    Add one text item to this new block. Set the max number of characters to 32767 and set Multiline to YES. Now create a form level, POST-QUERY trigger doing something similar to what you mentioned already doing:
    :text_item1 := :system.last_query

  • No tree displayed with WHERE clause (data issue?)

    I tried this on the apex.oracle.com workspace after it didnt run in our setup, and I ran into the same issue.
    I cant get the tree to display when I add a WHERE clause to the query.
    I know this isnt a problem with the WHERE clause, and has something to do with the data.
    If I just delete the data I dont want from the table (data_type <> 'S'), it WORKS, even with the WHERE clause.
    I have checked running the SQL, and the root element is returned.
    When I look at the HTML source of the page, I can see the js object created, though it seems to be constructed incorrectly.
    select case when connect_by_isleaf = 1 then 0
    when level = 1 then 1
    else -1
    end as status,
    level,
    "DATA_TEXT" as title,
    null as icon,
    "ID" as value,
    null as tooltip,
    null as link
    from "#OWNER#"."T_ROOT_CAUSE_TEMPLATE"
    where (data_type='S' or id=346)
    start with id=346
    connect by prior "ID" = "PARENT"
    order siblings by "DATA_SEQUENCE"

    Just in case if you didn't know it, you can use WITH factoring clause when creating a tree. It makes it possible to create as many "tables" as you need, while the final hierarchical query (that is responsible for the way the tree looks like) is a simple one. This (+WITH+) approach is convenient as you can avoid repeating inline views and/or subqueries.
    For example, your query might have looked like this:
    with s_type as
      (select * from t_template
       where data_type = 'S'
          or id = 346
    select
      case when connect_by_isleaf = 1 then 0
           when level = 1 then 1
           else -1
      end as status,
      level,
      data_text as title,
      null as icon,
      id as value,
      null as tooltip,
      null as link
    from
      s_type
    start with id=346
    connect by prior id = parent
    order siblings by data_sequence

  • Summary column with where clause

    Hi all,
    I'm using Oracle Report Builder 10GR2. I have the following issue: In one of the query i have the following result :
    Suppliers     0
    Suppliers     1408
    Total in  BGN     1408
    Customers      6024
    Customers      11779.32
    Customers      
    Total in  BGN     11779.32
    Taxes      0
    Taxes      0
    Total in  BGN     0
    Cash      1363.85
    Cash      691
    Cash      991.23
    Cash      688
    Total in  BGN     2355.08I want to make a sum for these columns where corresponds to description " Total in BGN" . Maybe it is a simple task... Do i have a chance to select from a query in a Report Builder?
    If yes, pls specify? Or maybe there is a chance to add a where clause for summary column. But keep in mind that this is one of the queries in the report builder and i have to add summary with this conditions. I cannot change the existing query but probably add a new one.
    Any ideas?
    DB Version: 11g
    Thanks in advance,
    Bahchevanov.
    Edited by: bahchevanov on Sep 29, 2012 2:21 AM

    Hello,
    You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
    Data Pump is faster and have more features and enhancement than regular imp and exp.
    You can do the following:
    sqlplus / as sysdba
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';then touch a file:
    touch par.txt
    In this file type the following the following :
    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
    expdp username/password parfile='par.txt'
    If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
    BR
    Mohamed ELAzab
    http://mohamedelazab.blogspot.com/

  • Export (expdp) with where clause

    Hello Gurus,
    I am trying to export with where clause. I am getting below error.
    Here is my export command.
    expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'” Here is error
    [keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10'                    <
    Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYS"."SYS_EXPORT_TABLE_03":  "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 386 MB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/TRIGGER
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
    Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
      /oracle/data_15/db1/TABLE1.dmp
    Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

    Hello,
    You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
    Data Pump is faster and have more features and enhancement than regular imp and exp.
    You can do the following:
    sqlplus / as sysdba
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';then touch a file:
    touch par.txt
    In this file type the following the following :
    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
    expdp username/password parfile='par.txt'
    If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
    BR
    Mohamed ELAzab
    http://mohamedelazab.blogspot.com/

Maybe you are looking for