TopLink doesn't sort data received using Named query

Hello!
I'm trying to build a Tree table using a TopLink Named query in my application.
There are Id, Parent|_Id, Code and Name columns in the corresponding database table, where Id and Parent|_Id are linked together by Foreign key (typical tree). I used TopLink to describe this table in the Model part of my application. There I wrote a Named query, without using a query constructor (not Expression radio button, but SQL radio button). Here the text of query:
select * from regions a connect by prior a.Id = a.Parent_Id start
with a.Id is null order by a.Code
Then I created a Data control and tried to build a JSF page with data based on this query, as tree-table.
But I discovered the fact, that data under the same node on the same leaf level of the Tree are not sorted by code on the JSF page. For example, data may be situated as follows (Code - Name):
2. wwwwwwwwwwww
2.3.kkkkkkkkkkkk
2.1.fffffffffffffffffffff
2.2.oooooooooo
1. qqqqqqqqqqqqqqqq
1. 2. lllllllllllllllllllllllllllll
1. 1. hhhhhhhhhhhhhh
etc.
I verified this query on other environment (PL/SQL Developer, SQL+), but didn't found such unsorted results anywhere.
Please, give me an advice to avoid this problem.
Thanks.

Hi
Something to do with TreeMap(TreeSet). I tried with TreeSet but it didn't work. Here is the code :
In servlet :
Connection lConnection = getConnection(pRequest);
String lSQL = "";
Statement lStatement;
ResultSet lResultSet;
Hashtable lLtypeHashtable = new Hashtable();
lStatement = lConnection.createStatement();
lSQL = "SELECT RCID,RCMEANING FROM REFERENCECODES WHERE RCDOMAIN = 'LOCATIONTYPE' AND RCROWSTATE > 0 order by RCMEANING";
lResultSet = lStatement.executeQuery(lSQL);
while(lResultSet.next())
String lRcid = lResultSet.getString(1);
String lRcmeaning = lResultSet.getString(2);
lLtypeHashtable.put(lRcid.trim(),lRcmeaning.trim());
if(lResultSet != null) lResultSet.close();
if(lStatement != null) lStatement.close();
pRequest.setAttribute("LtypeHashtable",lLtypeHashtable);
//Below Query is executed when one data from select element is selected
String lLType = DisplayUtilities.getString(pRequest.getParameter("LType"),true);
//LType is name of select element in JSP.
if (lLType != null)
lSQL = lSQL + " AND " + lUpperCaseFunction + "(LOCATIONTYPE)" +
" = " + DBUtilities.formatString(lLType.toUpperCase());
pRequest.setAttribute("rLType",lLType+"");
In JSp :
<%
Hashtable lLtypeHashtable = (Hashtable)request.getAttribute("LtypeHashtable");
%>
<TR>
<TD width="15%"> <div align="left">
<select name="LType" size="1" >
<option Value="">< Select ></option>
<%
if(lLtypeHashtable != null)
Enumeration enum = lLtypeHashtable.keys();
while(enum.hasMoreElements())
String key = (String)enum.nextElement();
String value = (String)lLtypeHashtable.get(key);
String flagBack = "";
if(key.equals((String)request.getAttribute("rLType")))
flagBack = "selected";
%>
<option Value="<%=key%>" <%=flagBack%>><%=value%></option>
<%
%>
</select></div>
</TD>
</TR>
How should I implement TreeSet?
Looking forward for an early reply.
Thanks.

Similar Messages

  • How to create olap cube using Named Query Table in Data source View

     I Create on OLAP Cube using Existing Tables Its Working Fine But When i Use Named Query Table with RelationShip To other Named query Table  It Not Working .So give me some deep Clarification On Olap Cube for Better Understanding
    Thanks

    Hi Pawan,
    What do you mean "It Not Working"? As Kamath said, please post the detail error message, so that we can make further analysis.
    In the Data Source View of a CUBE, we can define a named query. In a named query, you can specify an SQL expression to select rows and columns returned from one or more tables in one or more data sources. A named query is like any other table in a data source
    view (DSV) with rows and relationships, except that the named query is based on an expression.
    Reference:Define Named Queries in a Data Source View (Analysis Services)
    Regards,
    Charlie Liao
    TechNet Community Support

  • Data pump using table query

    I am trying to perform a data pump export on a table using a query within a parfile and I am getting some odd behaviour. The database version is 10.2.0.4.3 and the OS is AIX 5.3. The query looks like this.
    QUERY="POSDECLARATIONQUEUE:where SESSIONID in (select 'B.SESSIONID' from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where 'B.SESSIONID' = 'C.ID' and 'C.ACCOUNTID' = 'A.ID' and 'A.SITE' = '10252')"
    This works but gets 0 rows. If I run the query against the instance in an SQLPlus session as below then I get 0 rows returned.
    select * from POSDECLARATIONQUEUE where SESSIONID in (select 'B.SESSIONID' from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where 'B.SESSIONID' = 'C.ID' AND 'C.ACCOUNTID' = 'A.ID' and 'A.SITE' = '10252');
    If I take out the single quotes from around the columns within the query against the instance within SQLPlus, I get over 2000 rows returned.
    SQL> select count(*) from POSDECLARATIONQUEUE where SESSIONID in (select B.SESSIONID from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where B.SESSIONID = C.ID and C.ACCOUNTID = A.ID and A.SITE = 10252);
    COUNT(*)
    2098
    If I remove the single quotes from the parfile query then I get the following error within the data pump export.
    UDE-00014: invalid value for parameter, 'schemas'.
    The SCHEMAS option is not specified within the parfile and the TABLES option only specifies the table POSDECLARATIONQUEUE.
    Can someone assist with this, I just can't seem to be able to get the syntax right for it to work within data pump.
    Kind Regards.
    Graeme.
    Edited by: user12219844 on Apr 14, 2010 3:34 AM

    It looks like your query might be a little wrong:
    This is what you have:
    QUERY="POSDECLARATIONQUEUE:where SESSIONID in (select 'B.SESSIONID' from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where 'B.SESSIONID' = 'C.ID' and 'C.ACCOUNTID' = 'A.ID' and 'A.SITE' = '10252')"
    This is what I would have thought it should look like:
    QUERY=POSDECLARATIONQUEUE:"where SESSIONID in (select B.SESSIONID from POSACCOUNT A, POSDECLARATIONQUEUE B, POSDECLARATIONSESSION C where B.SESSIONID = C.ID and C.ACCOUNTID = A.ID and A.SITE = 10252)"
    You want double " arount the complete query, and you don't need the single ' around all of the =. The single ' are treating those values as strings and it says
    'B.SESSIONID' = 'C.ID'
    is the string B.SESSIONID equal to the string C.ID
    In your query that you used in sql was
    B.SESSIONID = C.ID
    which says is the value stored B.SESSIONID equal to the value stored at C.ID
    Which is what you want.
    Dean

  • Checking correct data format using sql query

    1) I got column date of joining which accepts date in below format
    DD-MON-YYYY
    DD-MON-YY
    MON-DD-YYYY
    MON-DD-YY
    Month DD,YYYY
    Question:- how do i check whether all dates in Date of joining column are in above format or not using sql query?
    2) I got one more date column which accepts date in below format
    MMDDYYYY
    YYYYMMDD
    MM/DD/YYYY
    MM/DD/YY
    YYYY/DD/MM
    Question:- how do i check whether all dates in date column are in above format or not using sql query?
    sorry if it is a very simple question since I am new to sql and trying to learn ......Thanks for the answers from the group............

    In short, NO, it's not possible.  If you store dates correctly in the database as DATE datatype then you don't have this problem.  If you store them as VARCHAR2 you have a problem.
    So, you get a date of 20092012
    Is that 20th September 2012?  or is it 20th December 2009?
    What about...
    11-Jan-12
    Is that 11th January 2012 or 12th January 2011?
    Dates should never be stored on the database as strings.  That is why Oracle gives you a DATE datatype so you can store them properly.
    Also, when dates are passed from an application to the database, the application should be passing them as DATE datatype, and the application interface should be designed to accept dates from the user in a format specific to their country/locality and it would then know what that format is and automatically convert it to a DATE datatype before it gets anywhere near the database or any SQL.

  • Retrieving array of objects using Named Query

    Can i retrieve an array of objects using a Named Query? The execute query method of Session returns only an Object but not an array. Please let me know if there is any possibility.
    Thanks in advance,

    Hi,
    You define a named ReadAllQuery query object, and after query execution, you can cast the returned Object as Vector, and further convert it to an array.
    King

  • Sort data from a Named Set - SSAS

    Hi All,
    I am trying to create a Named Set called as "Last 13 Weeks", mdx code looks like below:
    EXCEPT({EXCEPT({Tail([Time].[Week].members,14)}, 
    {[Time].[Week].[All]})},{Tail([Time].[Week].members,1)})
    I have a Dim_Date dimension which consists of data from 2013 till 2015 year.Columns like Date,week,month,year. The above Named set is created as week filter, which will show last 13 weeks excludes from current week. Looks like below.
    Row Labels
    Count
    2015-01-18
    1392
    2015-01-25
    1400
    2015-02-01
    1433
    2015-02-08
    1449
    2015-02-15
    1457
    2015-02-22
    1456
    2015-03-01
    1456
    2015-03-08
    1456
    2015-03-15
    1471
    2015-03-22
    1477
    2015-03-29
    1484
    2015-04-05
    1497
    2015-04-12
    1504
    Now, weeks are displaying in ascending order. I would like to sort them in descending order, means last week should be displayed at top level and rest are followed in descending order.
    Please help me how I can achieve this solution in Named Set ?
    Any replies will be appreciate. Thanks.
    Maruthi... http://www.msbimaru.blogspot.com/

    Hi Maruthi,
    According to your description, you want to get the data of last 13 week and sort them in descending order. Right?
    In MDX, for sorting the records, we can use Order() function to achieve it, in this scenario, we can order the members based on the member name. Please refer to query below:
    select [Measures].[Internet Sales Amount] on 0,
    ORDER(TAIL([Date].[Calendar Weeks].[Calendar Week].members,13),
    [Date].[Calendar Weeks].currentmember.member_name,desc) on 1
    from
    [Adventure Works]
    Also you can use the ORDER() function for your set expression:
    Order(
    EXCEPT({EXCEPT({Tail([Time].[Week].members,14)},
    {[Time].[Week].[All]})},{Tail([Time].[Week].members,1)}),
    [Time].currentmember.member_name,
    desc
    Reference:
    Order (MDX)
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Doesn't Sort data in Ascending order in Hash Table?

    Hello
    I am using JSP, Servlets. After quering in servlets, putting data in HashTable then set attribute in servlets, get attribute in JSP & retrieving data from HashTable in JSP & putting in select html element, data is not coming in ascending order in select drop down box. I need A,B,C,D but it is coming b,d,c,a. When I run query in DB, it shows in sequence but after putting in HashTable, it is not coming in sequence.
    How to make it ascending?
    Looking forward for an early reply.
    Thanks.

    Hi
    Something to do with TreeMap(TreeSet). I tried with TreeSet but it didn't work. Here is the code :
    In servlet :
    Connection lConnection = getConnection(pRequest);
    String lSQL = "";
    Statement lStatement;
    ResultSet lResultSet;
    Hashtable lLtypeHashtable = new Hashtable();
    lStatement = lConnection.createStatement();
    lSQL = "SELECT RCID,RCMEANING FROM REFERENCECODES WHERE RCDOMAIN = 'LOCATIONTYPE' AND RCROWSTATE > 0 order by RCMEANING";
    lResultSet = lStatement.executeQuery(lSQL);
    while(lResultSet.next())
    String lRcid = lResultSet.getString(1);
    String lRcmeaning = lResultSet.getString(2);
    lLtypeHashtable.put(lRcid.trim(),lRcmeaning.trim());
    if(lResultSet != null) lResultSet.close();
    if(lStatement != null) lStatement.close();
    pRequest.setAttribute("LtypeHashtable",lLtypeHashtable);
    //Below Query is executed when one data from select element is selected
    String lLType = DisplayUtilities.getString(pRequest.getParameter("LType"),true);
    //LType is name of select element in JSP.
    if (lLType != null)
    lSQL = lSQL + " AND " + lUpperCaseFunction + "(LOCATIONTYPE)" +
    " = " + DBUtilities.formatString(lLType.toUpperCase());
    pRequest.setAttribute("rLType",lLType+"");
    In JSp :
    <%
    Hashtable lLtypeHashtable = (Hashtable)request.getAttribute("LtypeHashtable");
    %>
    <TR>
    <TD width="15%"> <div align="left">
    <select name="LType" size="1" >
    <option Value="">< Select ></option>
    <%
    if(lLtypeHashtable != null)
    Enumeration enum = lLtypeHashtable.keys();
    while(enum.hasMoreElements())
    String key = (String)enum.nextElement();
    String value = (String)lLtypeHashtable.get(key);
    String flagBack = "";
    if(key.equals((String)request.getAttribute("rLType")))
    flagBack = "selected";
    %>
    <option Value="<%=key%>" <%=flagBack%>><%=value%></option>
    <%
    %>
    </select></div>
    </TD>
    </TR>
    How should I implement TreeSet?
    Looking forward for an early reply.
    Thanks.

  • Stuck trying to sort data from CONNECT BY query

    Hi,
    I am querying the Oracle E-Business Suiite menu tables.
    This query:
    #   MENU TREE WALK EXCLUDING FUNCTIONS
    SELECT     LPAD('_', (LEVEL - 1) * 10, '_') || fmev.prompt prompt
             , LEVEL
             , fmev.ENTRY_SEQUENCE
          FROM apps.fnd_menus_vl fmv
             , apps.fnd_menu_entries_vl fmev
         wHERE fmev.menu_id = fmv.menu_id
           AND fmev.prompt IS NOT NULL
    CONNECT BY fmev.menu_id = PRIOR fmev.sub_menu_id     
    START WITH fmv.menu_name = 'CN_SETUP';Generates this output:
    PROMPT                                   LEVEL     ENTRY_SEQUENCE
    Flexfields                              1     12
    __________Descriptive Flexfields               2     1
    Financials                              1     11
    __________Currencies and Rates                    2     5
    ____________________Rates                    3     10
    ______________________________Daily               4     5
    ______________________________Historical          4     10
    ______________________________Types               4     15
    ____________________Currency Rates Manager          3     5
    ______________________________Daily Rates          4     5
    ______________________________Historical Rates          4     10
    ______________________________Rate Types          4     15
    ____________________Define                    3     15
    __________GL Calendar                         2     2
    __________GL Period Types                    2     3
    __________GL Open and Close Periods               2     4
    Collections                              1     9
    __________Mappings                         2     1
    __________Runtime Values                    2     2
    External Table Mapping                         1     3
    Classification Rules                         1     4
    System Parameters                         1     1
    Payment Plans                              1     6
    Define Pay Groups                         1     14
    View Compensation Groups                    1     16
    Classification Rules                         1     22
    Credit Type Conversions                         1     21
    Credit Types                              1     20
    Interval Types                              1     19
    External Table Mapping                         1     18
    Define Security Profile                         1     17
    Define Payment Plans                         1     15
    Define Salesforce                         1     13
    Lookups                                   1     10
    Revenue Class                              1     8
    Dimensions                              1     7
    Revenue Class                              1     5
    Tables and Columns                         1     2I'd like to sort by fmev.entry sequence.
    However, if I do, I get this output:
    PROMPT                                   LEVEL     ENTRY_SEQUENCE
    System Parameters                         1     1
    __________Descriptive Flexfields               2     1
    __________Mappings                         2     1
    __________Runtime Values                    2     2
    Tables and Columns                         1     2
    __________GL Calendar                         2     2
    External Table Mapping                         1     3
    __________GL Period Types                    2     3
    __________GL Open and Close Periods               2     4
    Classification Rules                         1     4
    ____________________Currency Rates Manager          3     5
    ______________________________Daily Rates          4     5
    ______________________________Daily               4     5
    Revenue Class                              1     5
    __________Currencies and Rates                    2     5
    Payment Plans                              1     6
    Dimensions                              1     7
    Revenue Class                              1     8
    Collections                              1     9
    ______________________________Historical Rates          4     10
    ____________________Rates                    3     10
    ______________________________Historical          4     10
    Lookups                                   1     10
    Financials                              1     11
    Flexfields                              1     12
    Define Salesforce                         1     13
    Define Pay Groups                         1     14
    Define Payment Plans                         1     15
    ______________________________Types               4     15
    ______________________________Rate Types          4     15
    ____________________Define                    3     15
    View Compensation Groups                    1     16
    Define Security Profile                         1     17
    External Table Mapping                         1     18
    Interval Types                              1     19
    Credit Types                              1     20
    Credit Type Conversions                         1     21
    Classification Rules                         1     22That sort of works, except for where the tree-walking SQL has a parent/child scenario. I'd ideally like to get the output to look like this:
    PROMPT                                   LEVEL     ENTRY_SEQUENCE
    System Parameters                         1     1
    Tables and Columns                         1     2
    External Table Mapping                         1     3
    Classification Rules                         1     4
    Revenue Class                              1     5
    Payment Plans                              1     6
    Dimensions                              1     7
    Revenue Class                              1     8
    Collections                              1     9
    __________Mappings                         2     1
    __________Runtime Values                    2     2
    Lookups                                   1     10
    Financials                              1     11
    __________Currencies and Rates                    2     5
    ____________________Rates                    3     10
    ______________________________Daily               4     5
    ______________________________Historical          4     10
    ______________________________Types               4     15
    ____________________Currency Rates Manager          3     5
    ______________________________Daily Rates          4     5
    ______________________________Historical Rates          4     10
    ______________________________Rate Types          4     15
    ____________________Define                    3     15
    __________GL Calendar                         2     2
    __________GL Period Types                    2     3
    __________GL Open and Close Periods               2     4
    Flexfields                              1     12
    __________Descriptive Flexfields               2     1
    Define Salesforce                         1     13
    Define Pay Groups                         1     14
    Define Payment Plans                         1     15
    View Compensation Groups                    1     16
    Define Security Profile                         1     17
    External Table Mapping                         1     18
    Interval Types                              1     19
    Credit Types                              1     20
    Credit Type Conversions                         1     21
    Classification Rules                         1     22Where the pseudo order-by is like this:
    ORDER BY fmev.ENTRY_SEQUENCE for the lowest level, but where there is a submenu, then include those in the right place!
    Apologies for the fact I can't recreate the data here for use in testing, but as I'm using E-Bus tables, it's not so easy.
    Any advice much appreciated.
    Thanks

    ORDER SIBLINGS BY fmev.entry_sequence
    will help.
    roger

  • Date parameters using MDX query

    Hello experts,
    Not sure if this question falls under SSAS or SSRS but I'm writing it here for now and hopefully get the answer.
    I'm using SSAS cube to develop a report using SSRS and this is the first time I'm doing it. I want to filter records based on date range and did some research online. My report contains two datasets:
    1. dsMain dataset -> it contains all the field which I want to use in the report and added a parameter thru query designed with following settings:
    Dimension : Dates
    Hierachary : Date
    Operator : Range (Inclusive)
    Parameters : checked
    it created two parameters called FromDatesDate and toDatesDate
    2. I created another dataset called dsDate and wrote a custom query (found at following link) and changed FromDatesDate and ToDatesDate using this date dataset
    https://jsimonbi.wordpress.com/2011/03/22/using-a-date-parameter-in-ssrs-with-mdx/
    Query for dsDate
    WITH
    MEMBER DateValue
    AS
       [Dates].[Date].CurrentMember.UniqueName
    MEMBER DateLabel
    AS
       [Dates].[Date].CurrentMember.Name
    SELECT
        [Measures].[DateValue],
        [Measures].[DateLabel]
    } ON 0,
         [Dates].[Date].[Date]
    } ON 1
    FROM [myCube]
    Here is the value returned by dsDate dataset (above query)
                            DateValue                          DateLabel
    06/04/1980 [Dates].[Date].&[29375]
    06/04/1980
    06/05/1980 [Dates].[Date].&[29376]
    06/05/1980
    06/06/1980 [Dates].[Date].&[29377]
    06/06/1980
    06/07/1980 [Dates].[Date].&[29378]
    06/07/1980
    06/08/1980 [Dates].[Date].&[29379]
    06/08/1980
    06/09/1980 [Dates].[Date].&[29380]
    06/09/1980
    06/10/1980 [Dates].[Date].&[29381]
    06/10/1980
    06/11/1980 [Dates].[Date].&[29382]
    06/11/1980
    06/12/1980 [Dates].[Date].&[29383]
    06/12/1980
    06/13/1980 [Dates].[Date].&[29384]
    06/13/1980
    Here is what I changed in FromDatesDate and ToDatesDate parmeter:
    Under Available Values tab:
    Dataset : dsDate
    Value Field : DateValue
    Label Field : DateLabel
    Here are my questions:
    1. I want to use date/time parameter so that user doesn't have to scroll thru whole date dimension.
    2. I changed the FromDatesDate and ToDatesDate to date/time parameter, removed the values from Available values tab and made the following changes on Parmaeters expression under dsMain dataset
    =”[Dates].[Date].&[” + Format(CDate(Parameters!FromDatesDate.Value),”MM/dd/yyyy”)
    + “T00:00:00]”
    =”[Dates].[Date].&[” + Format(CDate(Parameters!ToDatesDate.Value),”MM/dd/yyyy”)
    + “T00:00:00]”
    Now when I run the report I get following error:
    Query (1, 55) The restrictions imposed by the CONSTRAINED flag in the STRTOMEMBER function are violated.
    I think the reason is by changing parameter to date/time, now I cannot get "DateValue" which is required for the query.
    1. What is the best way to work with date parameters?
    Hope it is all clear and look forward to hear from experts.
    Thanks,
    P
    mark it as answer if it answered your question :)

    Hi Parry2k,
    In Analysis Services, a member can be referenced by either its member name or by its member key. The member key is used by the dimension to specifically identify a given member. The ampersand (&) character is used in MDX to differentiate
    a member key from a member name. In this scenario, the datetime is member name, not the member key. So you should not add "&".
    Reference:
    Member Names and Keys
    Simon Hou
    TechNet Community Support

  • Data Template using sql query

    Hi All,
    I'm trying generate xml data using data template approach. For this do i need to use XSQL to generate xml data?
    Can some one please tell me what is this XSQL and how it works?
    Thanks in advance,

    Hi Srini,
    Thank you very much for the link, its elucidates the xml data generation process using data template.
    One more question: is this method called (uses) XSQL anywhere??
    Thanks,

  • How to display last 10 minutes data  only using sql query

    Hi,
    Presently, I'm using version is,
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE 11.1.0.6.0 Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    So, please consider SCOTT Schema to resolve my issue,
    I want to display only last 10 minutes what records are inserted or updated or deleted.
    Please provide in many ways!!
    ThankQ!!

    Hi,
    See below:
    select
    from
      emp
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    7369 SMITH      CLERK     7902 17-DEC-80     800             20
    7499 ALLEN      SALESMAN  7698 20-FEB-81    1600     300     30
    7521 WARD       SALESMAN  7698 22-FEB-81    1250     500     30
    7566 JONES      MANAGER   7839 02-APR-81    2975             20
    7654 MARTIN     SALESMAN  7698 28-SEP-81    1250    1400     30
    7698 BLAKE      MANAGER   7839 01-MAY-81    2850             30
    7782 CLARK      MANAGER   7839 09-JUN-81    2450             10
    7788 SCOTT      ANALYST   7566 19-APR-87    3000             20
    7839 KING       PRESIDENT      17-NOV-81    5000             10
    7844 TURNER     SALESMAN  7698 08-SEP-81    1500       0     30
    7876 ADAMS      CLERK     7788 23-MAY-87    1100             20
    7900 JAMES      CLERK     7698 03-DEC-81     950             30
    7902 FORD       ANALYST   7566 03-DEC-81    3000             20
    7934 MILLER     CLERK     7782 23-JAN-82    1300             10
    14 rows selected
    select
    from
      emp
    minus
    select
    from
      emp
       as of timestamp (systimestamp - interval '10' minute)
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    0 rows selected
    update
      emp
    set
      ename = ename || ' x'
    where
      empno = 7934
    --1 rows updated.
    select
    from
      emp
    minus
    select
    from
      emp
       as of timestamp (systimestamp - interval '10' minute)
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    7934 MILLER x   CLERK     7782 23-JAN-82    1300             10
    */For changes, deletes and inserts compair the two result (emp and emp as of timestamp (systimestamp - interval '10' minute) ) with each other.
    Regards,
    Peter

  • Toplink named query and firstrow

    In one of our projects we have a need to chunk records returned by a Toplink query.
    For example if a query retrieves 1000 rows we need to chunk records in batches of a variable number.
    Lets assume for this one request we need to chunk these 1000 rows in batches of 50 records. Is there a way to do this with Toplink?
    I tried to create a named query and then am setting the first row to 0 and max rows to 20
    And in a loop I am adding 20 to the value of the first row.
    This does not work. The first time the query runs the first row = 0 and the max rows = 20 and I get 20 records back as I expected, but the next time the query runs after I change the value of firstrows to 21 and I do not get any records back even though the DB has a 1000 records.
    Is it possible to do this sort of batching of the result set? I appreciate any pointers on how to solve this
    Thanks a lot for the help

    Hello,
    MaxRows is independent of firstResult in TopLink; unless using a database that supports pagination, MaxRows is applied to the statement, and then firstresults used on the returned resultset to skip to the desired first row. So, the driver would return 20 rows, and then firstResult skips to row 20 - so nothing gets returned.
    MaxRows and FirstResult are used in TopLink as the range you want to be returned. So both need to be incremented so that the difference between them is the max number of rows you want returned - MaxRows could be better described as a LastResult instead.
    Best Regards,
    Chris

  • How to use Power Query to load data from a single source into multiple tables

    Hi all,
    I have a requirement to load my data into three different data models using Power Query. Is that possible?
    My source is a SharePoint survey list, with similar questions like:
    1) Course lecturer - John Doe
    1a) The course was useful (rate 1 to 5)
    1b) The lecturer displayed good knowledge of topic (rate 1 to 5)
    2) Course Lecturer - Mary Brown
    2a) The course was useful (rate 1 to 5)
    2b) The lecturer displayed good knowledge of topic (rate 1 to 5)
    I would like to split the data into separate data models (one for John Doe; another for Mary Brown), so that I can compare the different lecturers. Other than running separate surveys for each of them, I thought of using Power Query to transform the data.
    Is it possible?
    Thanks.
    Regards
    GM

    Yes, this is possible.
    Start with a single query that returns you the data for all lecturers.
    Right-click on the "all lecturers" query in the queries pane, and choose Reference, once for each lecturer. This will create a query for each lecturer.
    Open the query for each lecturer and filter the data so that only that lecturer's results are visible.
    Click "Close & Load To..." for each lecturer's query  to load the data into the data model. This will create a data model table for each lecturer.
    If your question is more about how to transform such a survey list into a table that can be easily filtered, please provide an example of how the list shows up in Power Query.
    Ehren

  • Clear the data region using Maxl

    Hi,
    I am trying to clear the data region using Maxl query, I am getting error like: Dynamic members not allowed in data clear region specificaion.
    +alter database 'PGSASO'.'ASOPGS' clear data in region 'CrossJoin(CrossJoin({[Actual]},{[FY11]}),{[Inputs].Levels( 0 ).Members})';+
    (Inputs( not a dynamic member, parent of this meber is a dynamic) comes under Account dim).
    I have tried the below code also(Syntax error in input MDX queryon line 1 at token ',').
    alter database 'PGSASO'.'ASOPGS' clear data in region 'CrossJoin([Inputs].Levels(0), CrossJoin({[ACT]},{[FY11]}))';
    Can anyone do let me know if there is any syntax error or alternate function would be available for clearing level-0 members/descendants under Dynamic parent...
    Thanks,
    Bharathi

    There is no syntax error in your statement. The problem is you input dimension(I guess) has some members with formulas on them and the clear statement does not allow those members to be in the clear. Ther ware a couple of ways around it. seperate out the members with formulas under a different parent and then modify the crossjoin to only pick up the level zero members that are not in that parent or you could put a UDA on formula members and use the exclude command to exclude anything with that UDA

  • Snowflake dimension: named query vs. database view

    A test question features a Product table with a Product Size code; Product Size description is taken from ProductSize table. As far as I can tell, the question asks me to choose between (a) setting up a database view joining Product and ProductSize, and
    (b) doing the join in a data-source-view named query. I don't see a clear winner. (My thinking is as follows.  Yes, he view would speed up the processing, even if not materialized. On the other hand, with a small dataset, the performance gain would be
    minor in absolute terms. Do I want to have an extra database object in the picture?) Yet the question's author does. Can anyone advise please?  

    Hi Demyan,
    According to your description, you want to know which is better, using named query in datasource view or using database view, right?
    Based on my research, there is no performance differences between using named query in datasource view and using database view because they both result in SQL query being sent to the source system. Here is a blog which discuss this issue.
    Consistency: If you already have logic in database views, I would continue to use them. As long as you know that you go to one spot to view/change the logic. Putting the logic in 2 different spots could lead to confusion.
    Security Permissions: often you may not have permission to alter the source databases, in this case you have no choice but to setup named queries in the dsv.
    Reference
    http://geekswithblogs.net/darrengosbell/archive/2006/09/05/90278.aspx
    http://bennyaustin.wordpress.com/2013/07/16/dbview/
    Regards,
    Charlie Liao
    TechNet Community Support

Maybe you are looking for

  • Outlook Hangs - Loading Profile / Add Account Stage - Office 365 on Windows 8.1

    I have been using outlook via the Office 365 offering for a year. Then 2 days back suddenly my outlook stopped downloading mails from my mail server. It did however send mails. I went online to check the various causes and after following lots of adv

  • Cannot install printers

    I have a new Dell computer and a new model HP Pro 400 color laserjet printer. I crashed the computer during the HP software installation. I know what caused the crash so that is no problem. The software automatically uninstalled. Now I cannot add alm

  • Printing broken for HP LJ1150 over Lan

    All of sudden today I cannot print to my LaserJet 1150, although all other Win boxes can. The printer is connected via USB to a MacMini and shared over Lan. It's rather embarrassing. When I attempt to print from say Safari, I get a dialog that says "

  • Material Ledger activation at Company Code Level

    Hi All, I have a requirement where Material Ledger need to be activated at Company level and not at single Plant Level. We are about to implement ML and would like to have periodic unit price calculated at company code level  (e.g. 1 material, 4 plan

  • Prob in Order Creation

    Dear All Gurus,                             in the time of creating Order systems giving error "routing not found" .how to asign routing with order. i am new in pp .I am a mm consultant.pls help me out thanks sandip