Connect by prior problem with order by

Hi,
I and using connect by prior within a query on Oracle 8 and would like to order the results within the parent levels.
All the documentation that I have read shows that in Oracle 9i there is an option to say order siblings by which looks like what I need, but this does not work on Oracle 8.
Can anyone tell me how I can order the children within the parents without changing the tree structure?
I have also tried SYS_CONNECT_BY_PATH and I just get an error saying that it is an invalid column name,

Karen, see here for a dicussion on how to order the siblings in a pre-9i environment:
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:9212348049

Similar Messages

  • Problem with order data

    Hi, I have a problem with order data. A string column has these values:
    A....
    B....
    PSTA-FRA
    PSTA+FRA
    Q....
    R....
    If i order data directly from db ( select column1 from table order by column1 ) , i obtain this result:
    PSTA-FRA
    PSTA+FRA
    If i create a simple report on that table and order on that column the result is:
    PSTA+FRA
    PSTA-FRA
    I can obtain correct output if I set parameter 'Perform group on server' but if i write a selection formula :
    {table.column} >= 'PSTA+FRA'
    record containing PSTA-FRA value not appear.
    I've tried both with Crytal 8.5 and Crystal 11 R2 sp6, database is Sybase SQL Anywhere odbc connection.
    Thanks in advance

    Ordering is done according to the ASCII values of the characters.
    In R2 create a new report and log onto your DB and select Command for your data source. Paste in the SQL you use to get the data in the order the server users. Then you don't have to use CR to do the sorting. DB Servers are much more efficient at collecting the data than CR is.
    Thank you
    Don

  • Problem with order in iPhoto

    problem with order in iPhoto. I can't buy a card, because there comes an Message "Ihre Karte enthält offenbar Standardtext, der noch nicht bearbeitet wurde. Gedruckte Karten enthalten diesen Text nicht. Möchten Sie fortfahren?" What should I do?

    That message means that you have text boxes that have not been used.  The holding text that appears in the box will not be printed. But if you want to get rid of the warning just put a space in the text box.
    OR, check to see if the card layout has the same page but without a text box.  Most do.
    OT

  • Can SAP GRC AC 5.3 connect without any problem with SAP R/3 4.7 Enterprise?

    hello,
    I went to the PAM in the SAP Marketplace to see if SAP GRC AC 5.3 could connect to SAP R/3 4.7 Enterprise but I can't see all the "Add-On Product Version for...", it's cut off.
    Can SAP GRC AC 5.3 connect without any problem with SAP R/3 4.7 Enterprise?
    If I can't is there any proof about it? I have to show it to a client.
    Best Regards,
    Pablo Mortera,

    Pablo,
    GRC AC 5.3 works perfectly fine with SAP's R/3 4.6c, mySAP ERP 4.7 and ECC systems. In fact we have two 4.7 Enterprise systems connected to GRC AC 5.3 system.
    You can get the details of supported SAP ERP systems under prerequisite section of Info page of GRC AC 5.3 , it can be accessed on marketplace at -
    Downloads-->Installations and Upgrades - Entry by Application Group > SAP Solutions for Governance, Risk, and Compliance>SAP GRC Access Control>SAP GRC ACCESS CONTROL>SAP GRC ACCESS CONTROL 5.3
    Just ensure to have proper BASIS and ABAP support pack level as mentioned in prerequisites.
    Regards,
    Amol

  • Problem with order by clause

    Hai all,
    I have problem with order by clause,
    My query is
    "select number from table1 order by number asc "
    and the output is displaying as
    1
    10
    12
    13
    15
    17
    19
    2
    20
    21
    22
    But if we give order by it should display as below only right ?
    1
    2
    10
    12
    13
    15
    17
    19
    20
    21
    22 ........
    Please help me why it is not displaying like it. and how to make the statement to display like the second case. Thanks in advance.
    Regards,
    Uraja

    The column datatype that you are selecting is not of NUMBER datatype(might be char or varchar2) hence you are getting such result set.
    And for this purpose, it is recommended to set datatype of a column appropriately.
    For now you can add TO_NUMBER function to column in ORDER BY clause, only if it has data of number type.
    Edited by: Ora on 19 Nov, 2012 3:10 AM

  • Connect by prior by speific order problem.

    Oracle: 10.2.0.4
    I have a table containing events backup.
    i want to list the hierarchy within that backup oreder by the time_stamp for all levels.
    create table BCK_EVENTS
      bck_backup_id           NUMBER(9) default 0 not null,
      event_id                   NUMBER(15) default 0 not null,
      event_name              NVARCHAR2(100) default ' ' not null
      time_stamp               NUMBER(9) default 0 not null,
      parent_event            NUMBER(15) default 0 not null,
    add constraint BCK_EVENTS_PK primary key (BCK_EVENT_ID, EVENT_ID); // event_id is not unique can be under one or more backup id'sthis is not a tree with one root, there is more than one event in the root level (level 1).
    example:
    Event Name      Time         level   <- time is numeric but for easier reading.
    *Event A          10:00         1
       *Event C        10:30         2
         *Event B      11:17         3
    *Event H          12:10         1
         *Event J       12:10         2
         *Event M      12:21         2
    *Event Z          15:33         1
       *Event R        16:56          2
        *Event M      16:57          3
       *Event G        20:20         2What i tried was :
    select  lpad( '*', level*2 ) || event_id,event_name,time_stamp,parent_event,level from bck_events
         where bck_event_id=100031
         start with parent_event is null
        connect by prior event_id = parent_eventand there are two problems with it.
    1. it's not ordered even when i added an Index (parent_event,time_stamp) and try to hint it.
    2. it returns loads of multiple rows.
    hope it's clear enough. I thank for any help.
    Edited by: 973065 on Nov 25, 2012 8:04 AM
    Edited by: 973065 on Nov 25, 2012 9:23 AM
    Edited by: 973065 on Nov 25, 2012 9:29 AM
    Edited by: 973065 on Nov 25, 2012 9:31 AM

    Hi,
    973065 wrote:
    Oracle: 10.2
    I have a table containing events backup.
    i want to list the hierarchy within that backup oreder by the time_stamp for all levels.
    create table BCK_EVENTS
    bck_backup_id           NUMBER(9) default 0 not null,
    event_id                   NUMBER(15) default 0 not null,
    event_name              NVARCHAR2(100) default ' ' not null
    time_stamp               NUMBER(9) default 0 not null,
    parent_event            NUMBER(15) default 0 not null,
    Thanks for posting the version number and the CREATE TABLE statement. Don't forget to post INSERT statements for your sample data.
    add constraint BCK_EVENTS_PK primary key (BCK_EVENT_ID, EVENT_ID); // event_id is not unique can be under one or more backup id's
    this is not a tree with one root, there is more than one event in the root level (level 1).Is it a forest, that is, a set of trees?
    example:
    Event Name      Time         level   <- time is numeric but for easier reading.
    *Event A          10:00         1
    *Event C        10:30         2
    *Event B      11:17         3
    *Event H          12:10         1
    *Event J       12:10         2
    *Event M      12:21         2
    *Event Z          15:33         1
    *Event R        16:56          2
    *Event M      16:57          3
    *Event G        20:20         2
    That seems to be a forest, that is, every row has 0 or 1 parent, and no row is its own ancestor.
    What i tried was :
    select lpad( '*', level*2 ) || event_id,event_name,time_stamp,parent_event,level from bck_events
    where bck_event_id=100031
    start with parent_event is null
    connect by prior event_id = parent_event
    and there are two problems with it.
    1. it's not ordered even when i added an Index (parent_event,time_stamp) and try to hint it.Depending on your data, you may just need to add
    ORDER SIBLINGS BY  time_stampat the end, after the CONNECT BY clause.
    If you need rows sorted by time_stamp under their roots, but otherwise without regard to the hierarchy, then use CONNECT_BY_ROOT.
    2. it returns loads of multiple rows.Again, it depends on your data. I'll bet you need something more in the CONNECT BY clause, but I can't tell what without some sample data and an exxplanation of how you gett the results you posted from that data. The fact that bck_event_id is part of the primary key makes me suspect that maybe bck_event_id needs to be somewhere in the CONNECT BY clause, but that's just a wild guess.
    hope it's clear enough. I thank for any help.As mentioned before, see the forum FAQ {message:id=9360002}

  • Oracle Virtual Machine Connect by Prior Problem

    Hi Friends ,
    In my company we have virtualization. this is new in our organization.
    oracle image have been taken and put in to virtual machine.(vmware).
    after that, procedure which has "connect by prior" start to create wrong output.
    please help us on what to do to correct problem given above.
    (my oracle version 10g)

    JAVAMAN2 wrote:
    simple sample:
    SELECT ROWNUM+2000-1 AS YIL FROM DUAL CONNECT BY ROWNUM <= 2010-2005 ORDER BY ROWNUM+2000-1 DESC;output on virtual machine
    2009,2008,2007,2006,2005
    output on real world
    2010,2009,2008,2007,2006,2005If that is really the output from that query, then both your virtual machine and your "real world" are broken. On all 4 versions of Oracle I have available, I get:
    SQL> SELECT ROWNUM + 2000 - 1 AS YIL
      2  FROM DUAL
      3  CONNECT BY ROWNUM <= 2010 - 2005
      4  ORDER BY ROWNUM + 2000 - 1 DESC;
           YIL
          2004
          2003
          2002
          2001
          2000Which is what I would expect given that 2010 - 2005 = 5.
    Perhaps if you showed an actual cut and paste from a sqlplus session on each machine someone might be able to help, however, I'm inclined to agree with sb92075 that it is a data issue in your real query.
    John

  • Problems with 'Order Prints' from Aperture 2.1.3 Mystery borders

    *Some background:*
    I've been using Aperture for about 3 months now, importing most of my iPhoto library into the program. I have only recently started shooting in RAW format, most of my photos image files are in JPG format. In the past, I've had no problems with obtaining prints from within iPhoto or to a limited extent Aperture. So, far as I know my program is up-to-date. I have 2 plugins installed: Aperture2twitter and *flickr export Lite* both of which work acceptably.
    *The problem:* I ordered 317 4×6 prints from my aperture library.
    Every photo has a 1/4″ border on both sides of the image, i.e. the printed image is only 4×5 1/2″. I have never ordered this quantity before, but I don’t believe that was the problem, it appears that the processing machine was misaligned and no one reviewed the prints prior to shipping.
    I tried again, on 4 different images ... all JPG files with 3 out of 4 were OK, but one exhibited the "border" issue.
    I haven't a clue what is going on here. Apple implied +(via email)+ that I would have to individually crop every photo to ensure proper aspect ratio. This makes no sense to me at all, as I have never had this kinda problem before.
    Could the plugin(s) be interfering with the s/w? Is there a trick to having photos printed from within Aperture that was not present in iPhoto?
    Any thoughts on what the problem is would be greatly appreciated.
    Thanks
    -john

    I believe that I've solved this problem, with the help of the folks at Apple who handle Aperture tech support using the Aperture support ID that came with the product.
    So the short answer is: Aperture print services REALLY DO REQUIRE the image to be cropped (constrained as they say) prior to the data being sent to Apple Print services.
    Here is the link that describes cropping http://support.apple.com/kb/HT1993?viewlocale=en_US
    The process as described is cumbersome, but the support tech pointed out that in Aperture, crops are 'non-destrutive' and can be undone simply by removing the check mark on the Adjustments tab of the image you crop. *This means that you do not have to make a duplicate image for cropping.*
    So, here is the process that I arrived at to ensure that my "order prints" job turned out:
    1. create an album of all the photos you want to submit for printing.
    2. for each image call up the Crop HUD by pressing 'c' on the keyboard.
    3.select the aspect ratio that you want for your photo. Make sure that it does NOT SAY Master Aspect Ratio, or Main Display Aspect Ratio.
    4. Crop the photo
    on the adjustments tab you can see the X and Y data and Height / Width information which can be undone.
    5. Submit your print request to Apple for all the cropped photos.
    When the prints arrive, you can compare the prints with the submitted photos. They should all be good. You can then delete the album (since it really is not a physical thing) or keep it for reference.
    It all seemed a bit arcane to me, as I never had to worry about this in iPhoto. It must be that iPhoto sends different data than Aperture. I have just received 200 + prints back from Apple Print Services with about 98% success rate. I just have to adjust my thinking and my process when dealing with Aperture.

  • Join two Connect By Prior Start With trees and return only common records?

    Oracle 10g Release 2 (10.2)
    I have two tables that have tree structured data. The results, when running the queries individually are correct, however I need to join tree one to tree two in order to obtain only the common records between them.
    -- Tree one
    SELECT ip_entity_name, entity_code, hier_level, entity_parent
    FROM ip_hierarchy
    WHERE hier_level >= 3
    CONNECT BY PRIOR entity_code = entity_parent
    START WITH entity_code = 'MEWWD';
    -- Tree two
    SELECT ip_entity_name, entity_code, hier_level, entity_parent
    FROM ipt_hierarchy
    WHERE hier_level >= 3
    CONNECT BY PRIOR entity_code = entity_parent
    START WITH entity_code = 'IPNAM';
    As I understand, joins may not work with CONNECT BY/START WITH queries?
    Is a WITH clause an option?
    If at all possible, I don't want to put one select in a View database object and join against the other query.
    Thanks.

    Hi JTP51,
    You can use WITH clause or sub-query by using in-line view, without creating any view object in database.
    for example
    SELECT A.IP_ENTITY_NAME, A.ENTITY_CODE, ....
      FROM (SELECT IP_ENTITY_NAME, ENTITY_CODE, HIER_LEVEL, ENTITY_PARENT
              FROM IP_HIERARCHY
             WHERE HIER_LEVEL >= 3
            CONNECT BY PRIOR ENTITY_CODE = ENTITY_PARENT
             START WITH ENTITY_CODE = 'MEWWD') A,
           (SELECT IP_ENTITY_NAME, ENTITY_CODE, HIER_LEVEL, ENTITY_PARENT
              FROM IPT_HIERARCHY
             WHERE HIER_LEVEL >= 3
            CONNECT BY PRIOR ENTITY_CODE = ENTITY_PARENT
             START WITH ENTITY_CODE = 'IPNAM') B
    WHERE A. ENTITY_CODE = B. ENTITY_CODE
    AND ....Best regards,
    Zhxiang
    Edited by: zhxiangxie on Feb 2, 2010 5:35 PM

  • CONNECT BY, Performance problems with hierarchical SQL

    Hello,
    I have a performance problem with the following SQL:
    table name: testtable
    columns: colA, colB, colC, colD, colE, colF
    Following hierarchical SQL:
    SELECT colA||colB||colC AS A1, colD||colE||colF AS B1, colA, colB, colC, level
    FROM testable
    CONNECT BY PRIOR A1 = B1
    START WITH A1 = 'aaa||bbbb||cccc'
    With big tables the performance of this construct is very bad. I can't use functional based indexes to create an Index on "colA||colB||colC" and "colD||colE||colF"
    Has anyone an idea how I can get a real better performance for this hierarchical construct, if I have to combine multiple colums? Or is there any better way (with an PL/SQL or view trigger) solve something like this ??
    Thanks in advance for your investigation :)
    Carmen

    Why not
    CONNECT BY PRIOR colA = colD
    and PRIOR colB = colE
    and ...
    ? It is not the same thing, but I suspect my version is correct:-)

  • Problem with order!

    Hello I ordered in you iphone 5S 16gb gold. Now I need to cancel this order but I didn't enter the APPLE ID at purchase and now when I want it to cancel it writes to me The signed in account does not have access to this order.

    You're not writing to Apple here just to other users like yourself.
    If you are having a problem with an order you will need to get in touch with Apple directly.
    regards

  • Problem with ORDER BY

    Hi at all,
    i have noticed a serious problem with our APEX installation.
    We are importing textfiles in our database through a PL/SQL Procedure.
    The files look like XXXXXXXX.12A, means an alphanumeric ending.
    It is important that the files are read in a specific order.
    When I run this procedure in SQL-Plus or through a Scheduled Job everything works fine, means
    XXXXXXXX.129 is read before XXXXXXXX.12A.
    When I call this procedure through an apex page
    XXXXXXXX.129 is read after!!! XXXXXXXX.12A.
    Here is a little extract of this procedure.
    Can someone help?
    Thanks
    Ralf
    CREATE OR REPLACE PROCEDURE TEST
    AS
    CURSOR c_filelist
    IS
    SELECT file_name,
    status
    FROM DFUE_FILELIST
    ORDER BY file_name;
    c_filelist_rec c_filelist%ROWTYPE;
    v_file_name varchar2(50);
    v_file_count number(3) :=0;     
    BEGIN
         FOR c_filelist_rec IN c_filelist LOOP
         v_file_count := v_file_count+1;                                   
         v_file_name := c_filelist_rec.file_name;
         P_WRITELOG ('LOGTABLE','USER', 'TEST', '0', '0',to_char(v_file_count)||' '||v_file_name);
    --This is just a procedure which INSERTS the output in a table
         END LOOP;                              
    END;          
    table looks like that, through the APEX call
    LOG_DTM     PROG_USER     PROG_NAME     PROG_VERSION     PROG_RELEASE     LOGTEXT
    02.03.2010 09:58:35     USER TEST     0     0     1 XXXXXXXX.10A
    02.03.2010 09:58:35     USER TEST     0     0     2 XXXXXXXX.10B
    02.03.2010 09:58:35     USER TEST     0     0     3 XXXXXXXX.106
    02.03.2010 09:58:35     USER TEST     0     0     4 XXXXXXXX.107
    02.03.2010 09:58:35     USER TEST     0     0     5 XXXXXXXX.108
    02.03.2010 09:58:35     USER TEST     0     0     6 XXXXXXXX.109

    This is probably because you have the NLS parameters set to some linguistic sort in APEX. You can override this by using:
    ORDER BY NLSSORT(file_name, 'NLS_SORT = BINARY')

  • Problem with 'order by' and comparison operator with varchar2 field

    I have a problem with the following sql query (field1 is varchar2):
    SELECT field1
    FROM tablename
    WHERE field1 > 'AA10BB'
    ORDER BY field1
    The contents of field1 is:
    AA10BB
    AA10-10BB
    AA10-12BB
    The sql query without the WHERE clause sorts field1 this way:
    AA10BB
    AA10-10BB
    AA10-12BB
    But the sql query with the WHERE clause has no hits.
    It seems that when sorting the minus character is greater than the 'B' character and
    at the comparison ( > 'AA10BB' ) the minus character is lower than the 'B' character!
    The database and client NLS_PARAMTER are GERMAN_GERMANY.
    The database is 9.2.0.7
    Has anyone an idea?

    thanks for your fast reply!
    My problem was that NLS_SORT was set to 'GERMAN' and NLS_COMP to 'BINARY'.
    NLS_SORT = GERMAN orders the varchar2 fields in form of 'a A b B ... 0 1 2 3 ..'
    NLS_COMP = BINARY compares binary (ASCII-Table).
    I use now:
    SELECT field1
    FROM tablename
    WHERE field1 > 'AA10BB'
    ORDER BY NLSSORT(field1, 'NLS_SORT = Binary'');

  • Connect by prior problem

    hi friends i have table like tree which have have two different type of leaf
    my tables
    deparment did,name
    person perid,name
    treetable id, pid,did,perid--tree table one row have only did or pid if did =2 , peridhave to be nullso i generate hierarchial structure between person and deparments
       id      pid       did     perid
        1     null       1        null
        2    1          null        1     
        3     2         null        2
        4     2          null       3   
        5     3          2          null
       6     5          null       4  
        7     5          null       5for example i select first deparment's person querry result must be (id=)2,3,4 not 6,7 because 6,7 below 5
    can we write with connect by prior it?

    Hi,
    JAVAMAN2 wrote:
    hi friends i have table like tree which have have two different type of leaf
    my tables
    deparment did,name
    person perid,name
    treetable id, pid,did,perid--tree table one row have only did or pid if did =2 , peridhave to be nullso i generate hierarchial structure between person and deparments
    id      pid       did     perid
    1     null       1        null
    2    1          null        1     
    3     2         null        2
    4     2          null       3   
    5     3          2          null
    6     5          null       4  
    7     5          null       5for example i select first deparment's person querry result must be (id=)2,3,4 not 6,7 because 6,7 below 5I'm not sure why you want to exclude 5, 6 and 7. Is it that you don't want any nodes (except the root) with NULL perid?
    can we write with connect by prior it?Yes.
    If my guess about excluding 5 and it's descendants is correct:
    SELECT     *     -- or whatever you want
    FROM     treetable
    START WITH     pid     IS NULL
    CONNECT BY     pid     = PRIOR id
         AND     depid     IS NULL
    ;If you need the names from the other tables, then outer-join both other tables, and use NVL to get the one name that is not NULL.

  • Problems with ordering Books from iPhoto '09

    I tried ordering 2 books from iPhoto ’09 (version 8.1.2 (424) - this is the iPhoto that I have) yesterday, and I got this message: "Please check your network connection and try again"... so I checked my network connection and it was fine. I tried again summiting the order and the same message appeared again
    I checked all the photos and everything look fine. So, I tried to summit the order again. The same message appeared. I stopped trying sending it again.
    After, I checked my emails and saw that I got charged 3 times for the books! I never got an email from apple with a confirmation number for the order(s) nor nothing! I tried looking for a number or email that I can send them about my problem but I can’t anything.
    Please Help! I have a deadline to meet.
    How can I know if at least one order went through and how can I stop two of the charges?

    To check orders go to your account in the apple store and check order status
    LN

Maybe you are looking for