3750x Stack UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree

A Cisco Stack 3750X switch report the following error message:
%UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree.
every minute +-20 sec
Cisco IOS Software, C3750E Software (C3750E-IPBASEK9-M), Version 15.0(2)SE4, RELEASE SOFTWARE (fc1)
analog bug: https://tools.cisco.com/bugsearch/bug/CSCsz93221

WS-C3750G-24PS-E C3750-IPBASEK9-M version 12.2(53)SE2
After implementing 802.1x with Avaya IP phones
%UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree
Port then fails authentication and goes into vl-err-dis

Similar Messages

  • %UTIL-3-DLL: Data structure error -- non-tail element contains NULL next p

    I am getting the error in my 7200 vxr router where running ios is c7200p-advipservicesk9-mz.124-15.T4.bin
    my observation is
    when tunnel interface is going down that time i am getting this error
    error is
    %UTIL-3-DLL: Data structure error -- non-tail element contains NULL next pointer, -
    Traceback= 0x140C170 0x3760FDC 0xE0E31C 0xE0EB80 0xE0B910 0x1A4C9FC 0x1A4CC44 0x1A5C378 0x168B05C 0x2D9298 0x1A3E854 0x1A3F110 0x2930240 0x2E5850 0x2905A30 0x2905F08

    It does not say much !
    The following are utility messages.
    Message
    %UTIL-3-DLL : Data structure error -- [chars]
    Explanation A software error occurred, resulting in a data structure inconsistency.
    Recommended Action Copy the message exactly as it appears on the console or in the system log. Research and attempt to resolve the issue using the tools and utilities provided at
    http://www.cisco.com/tac. With some messages, these tools and utilities will supply clarifying information. Also perform a search of the Bug Toolkit
    http://www.cisco.com/pcgi-bin/Support/Bugtool/home.pl. If you still require assistance, open a case with the Technical Assistance Center via the Internet
    http://tools.cisco.com/ServiceRequestTool/create, or contact your Cisco technical support representative and provide the representative with the gathered information.

  • %UTIL-3-DLL: Data structure error -- non-tail element contains NULL next po

    I am getting the error in my 7200 vxr router where running ios is c7200p-advipservicesk9-mz.124-15.T4.bin
    error is
    %UTIL-3-DLL: Data structure error -- non-tail element contains NULL next pointer, -
    Traceback= 0x140C170 0x3760FDC 0xE0E31C 0xE0EB80 0xE0B910 0x1A4C9FC 0x1A4CC44 0x1A5C378 0x168B05C 0x2D9298 0x1A3E854 0x1A3F110 0x2930240 0x2E5850 0x2905A30 0x2905F08
    Please help me out from this problem

    Error message decoder results:
    1. %UTIL-3-DLL: Data structure error -- %s A software error occurred, resulting in data structure inconsistency.
    Recommended Action: Copy the message exactly as it appears on the console or in the system log.  Research and attempt to resolve the issue using the tools and utilities provided at  http://www.cisco.com/tac. With some messages, these tools and utilities will supply clarifying  information. Search for resolved software issues using the Bug Toolkit at  https://tools.cisco.com/bugsearch/?referring_site=emd. If you still require assistance,  open a case with the Technical Assistance Center via the Internet at  https://tools.cisco.com/ServiceRequestTool/scm/mgmt/case, or contact your Cisco technical support  representative and provide the representative with the information you have gathered. Attach the  following information to your case in nonzipped, plain-text (.txt) format: the output of the show  logging and show tech-support commands and your pertinent troubleshooting logs.
    Related documents- No specific documents apply to this error message.

  • Can't remove a node from a tree

    I am using the custom tree dataDescriptor provided in Flex live
    doc. It works for creating the tree and add notes, however when I
    try to remove a node from the tree it cant work. Does anyone have
    any idea?
    This is the code for MyCustomeTreeDataDescriptor.as
    package
    import mx.collections.ArrayCollection;
    import mx.collections.CursorBookmark;
    import mx.collections.ICollectionView;
    import mx.collections.IViewCursor;
    import mx.events.CollectionEvent;
    import mx.events.CollectionEventKind;
    import mx.controls.treeClasses.*;
    public class MyCustomTreeDataDescriptor implements
    ITreeDataDescriptor
    // The getChildren method requires the node to be an Object
    // with a children field.
    // If the field contains an ArrayCollection, it returns the
    field
    // Otherwise, it wraps the field in an ArrayCollection.
    public function getChildren(node:Object,
    model:Object=null):ICollectionView
    try
    if (node is Object) {
    if(node.children is ArrayCollection){
    return node.children;
    }else{
    return new ArrayCollection(node.children);
    catch (e:Error) {
    trace("[Descriptor] exception checking for getChildren");
    return null;
    // The isBranch method simply returns true if the node is an
    // Object with a children field.
    // It does not support empty branches, but does support null
    children
    // fields.
    public function isBranch(node:Object,
    model:Object=null):Boolean {
    try {
    if (node is Object) {
    if (node.children != null) {
    return true;
    catch (e:Error) {
    trace("[Descriptor] exception checking for isBranch");
    return false;
    // The hasChildren method Returns true if the node actually
    has children.
    public function hasChildren(node:Object,
    model:Object=null):Boolean {
    if (node == null)
    return false;
    var children:ICollectionView = getChildren(node, model);
    try {
    if (children.length > 0)
    return true;
    catch (e:Error) {
    return false;
    // The getData method simply returns the node as an Object.
    public function getData(node:Object,
    model:Object=null):Object {
    try {
    return node;
    catch (e:Error) {
    return null;
    // The addChildAt method does the following:
    // If the parent parameter is null or undefined, inserts
    // the child parameter as the first child of the model
    parameter.
    // If the parent parameter is an Object and has a children
    field,
    // adds the child parameter to it at the index parameter
    location.
    // It does not add a child to a terminal node if it does not
    have
    // a children field.
    public function addChildAt(parent:Object, child:Object,
    index:int,
    model:Object=null):Boolean {
    var event:CollectionEvent = new
    CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
    event.kind = CollectionEventKind.ADD;
    event.items = [child];
    event.location = index;
    if (!parent) {
    var iterator:IViewCursor = model.createCursor();
    iterator.seek(CursorBookmark.FIRST, index);
    iterator.insert(child);
    else if (parent is Object) {
    if (parent.children != null) {
    if(parent.children is ArrayCollection) {
    parent.children.addItemAt(child, index);
    if (model){
    model.dispatchEvent(event);
    model.itemUpdated(parent);
    return true;
    else {
    parent.children.splice(index, 0, child);
    if (model)
    model.dispatchEvent(event);
    return true;
    return false;
    // The removeChildAt method does the following:
    // If the parent parameter is null or undefined, removes
    // the child at the specified index in the model.
    // If the parent parameter is an Object and has a children
    field,
    // removes the child at the index parameter location in the
    parent.
    public function removeChildAt(parent:Object, child:Object,
    index:int, model:Object=null):Boolean
    var event:CollectionEvent = new
    CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
    event.kind = CollectionEventKind.REMOVE;
    event.items = [child];
    event.location = index;
    //handle top level where there is no parent
    if (!parent)
    var iterator:IViewCursor = model.createCursor();
    iterator.seek(CursorBookmark.FIRST, index);
    iterator.remove();
    if (model)
    model.dispatchEvent(event);
    return true;
    else if (parent is Object)
    if (parent.children != undefined)
    parent.children.splice(index, 1);
    if (model)
    model.dispatchEvent(event);
    return true;
    return false;
    This is my tree definition:
    <mx:Tree width="143" top="0" bottom="0" left="0"
    height="100%"
    id="publicCaseTree"
    dataDescriptor="{new MyCustomTreeDataDescriptor()}"
    dataProvider="{ac}"
    defaultLeafIcon="@Embed('assets/caseIcon.png')"
    change="publicTreeChanged(event)"
    dragEnabled="true"
    dragMoveEnabled="false"/>
    This is how I remove the selected node from the tree. When
    Delete button is clicked, the doDeleteCase function is
    exectuted.
    public function publicTreeChanged(event:Event):void {
    selectedNode =
    publicCaseTree.dataDescriptor.getData(Tree(event.target).selectedItem,
    ac);
    public function doDeleteCase(event:Event):void{
    publicCaseTree.dataDescriptor.removeChildAt(publicCaseTree.firstVisibleItem,
    selectedNode, 0, ac);
    Any help would be appreciated.Thanks.

    Finally I removed nodes from tree, but not sure I did in the
    right way. Anybody encounter the same problem, please
    discuss.

  • What Tree Data Structures does Java Include?

    Hello,
    I have been reading about several tree data structures like a binary search tree, self-balancing bst, minimum spanning tree, red-black tree, AVL tree, etc... Are there data structures in Java represent the various trees, or is implementation of the ds left to user?
    Eric

    "Java" can be termed the "Java Language". The language does not have trees.
    In more general usage "Java" can refer to a standard, desktop, delivered VM which includes the standard Java API. The types that you are asking about would be found in the following package.
    [http://java.sun.com/javase/6/docs/api/java/util/package-summary.html]
    "Java" could also refer to any other commonly available implementations. In that case probably anything that can be implemented has been implemented somewhere. Googling works.

  • Trees Data Structures in Java

    Hi all !
    Currently I�m developing a Java software that requires a Tree data structure. Searching through Java API I�ve found classes like TreeMap and TreeSet, but although these classes seens to use tree structure behind what they really provide are linear data structure, not a tree data structure. My question is if there is a public and free Java tree data structure that permits to do activities such as:
    - Search for a particular node (efficiently)
    - Insert children to any node
    - Maintain one Object in each node
    Simple like this ! It must have something like this in Java, but I just can�t find it and I�m just too lazy to implement it :) ! Anyone can help me ?
    Thanks in advance !

    Mel,
    I�ve seen javax.swing.tree.TreeModel and its seens more like an implementation of Control in swing MVC (Model Vision Control) swing paradigm for JTree. It has listeners generated for manipulation events for example. It uses javax.swing.tree.DefaultMutableTreeNode for its nodes, and maybe I could use this class for the nodes of my tree since it has many useful operations. However still I miss a node searching operation that this class doesn�t have.
    Yes my problem is a simple Tree, but it is simple now and it might become much more complex, demanding more operations on the tree and specially efficient searching algorithms. Thats why I�m looking for a complete solution and I prefer something that is already done and well tested :) !
    Thanks for your tip !

  • Copy node from XML tree problem

    I am trying to copy an XML node 9whic hmay have child nodes) from one tree to another with the code
    nodes = dataDoc.getElementsByTagName("text");
                   currentElement = (Element) nodes.item(0);
                   textNode.appendChild(nodes.item(0).cloneNode(true));
    gives the error
    org.apache.crimson.tree.DomEx: WRONG_DOCUMENT_ERR: That node doesn't belong in this document.
         at org.apache.crimson.tree.ParentNode.checkDocument(ParentNode.java:250)
         at org.apache.crimson.tree.ParentNode.appendChild(ParentNode.java:333)
    What am I doing wrong?
    Regards,
    MArk

    What am I doing wrong?Failing to use the Document.importNode() method.

  • Is there a Java API for Tree data structure?

    Hi,
    I am wondering is there any Java API to work on Tree based data structure.
    I could read in some forums / sites that teach me how to create tree based objects using collection.
    But I wanted to know is there any core java API that can be used directly for tree based operations. (like binary tree or other type of trees)
    Please comment on this doubt.

    Headed using google and other stuff not found one.
    Suggestion: Why not start building the one, its a good idea to do that, isn't it.

  • Deleting Nodes from XML Tree (JTree)

    I have created a XML Tree(extended from JTree) using XNodes ( extended from DefaultMutableTreeNode)
    After some insertions, i need to delete certain nodes from the XML Tree.. but after deletion, XNode will be null.
    subroutine is as follows...
    appreciates any advice
    Thanx
    private XNode RemoveExtraNode( XNode xNode ){
    int child;
    String nodeType;
    XNode childNode=null;
    if ( (child=xNode.getChildCount() ) > 0){
    for(int i=0;i<child;i++){
    childNode=(XNode)xNode.getChildAt(i);          
         nodeType = childNode.getType();
         if(nodeType.equals("DTD") )
         childNode.removeFromParent();
    }//end for (int i=1;i<child;i++)
    }//endif((child=xNode.getChildCount())!=0)
    return xNode;     
    }//RemoveExtraNode

    Hi IKEDA
    Thanx for the reply.
    I have tried xNode.remove(childNode) b4 and it still return a null JTree.
    Anyway fyi i discover i can delete last child of xNode and return the correct java tree. therefore to delete a node of my choice i simply insert its next sibling nodes in its place and delete that particular node when it becomes the last child.

  • Question on removing a child node in a tree component - JSF

    When I m trying to delete a child node in a tree component the focus is not transfering to the parent node. I m using the setselected method to set the focus to the current node but not sure how to transfer the focus to parent node once I delete a child node. Please advice.

    Doubleposted: [http://forums.sun.com/thread.jspa?threadID=5389876]. Please stick to one topic or use the edit button.

  • Tree   Data  Structure

    Hello Guys,
    I am stuck in my project for a while and decided to contact you guys for ideas because am short of ideas how to get it done. This is the task: I have information like this from the server and have to create a tree structure from the information(data). The data from the server comes in this form:
    APP               net       main
    Account        net      main
    Address        net      main
    Person        net      OptelClient3
    Person        net      ggggg
    Person        net      show
    Bindings    apple    parse
    Bindings    apple    findProject
    Bindings    apple    show
    The positions of the columns is not fixed. The first column can become the second or the third depending on the preference of the user.
    1)
    The task is this:
    In each row , the first data must be the parent of the second data, the second data must be the parent of the third data and if there appears to be a fourth data then it will be the child of the third and it follows like that......
    I have to be able to build this tree structure whiles am looping over the information from the server.
    *****Optional Requirement****
    And if it is possible i must also be able to use the structure to create a table.
    I have spent much time(weeks after weeks) doing it but its not working so am asking if someone can help me with ideas how to get this done or point me to a tutorial where i can have a deep understanding of how i can do it.
    Thank for your help.

    Thanks for your reply.
    I have to implement the tree from the list i receive from the server. Each column belongs to the same class. For instance the first column will belong to a class called say "cHuman" and i will set the name attribute of each class to the names of the first column.
    The second coulumn will belong to the same class say "cPackage"and i will set each to the names of the second column datas. This apply to the rest of the columns.
    What am asking is simple. How can i build the tree dynamically so that the in each row, every data is parent to the next data. That is all what i want. What am doing is correct but i just need how to create the tree dynamically. Show me how to build trees dynamically from data.
    Thanks.

  • SAP data structure error

    Dear Expert
         When I am trying to add any UDF, Delete UDF and Crate FMS then we get error
    "[Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid column name 'USER_CODE'.  '' (SEVT) (SEVT)"
    I trying to see my all FMS but there we dont found any problem.
    Please try to provide me the answer.
    Thanks in advance

    Hi Gordon
    I have the same error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid column name 'USER_CODE'.  '' (SEVT) (SEVT).
    I started getting this error after I uninstalled and then re-installed the server component of SAP B1 Start-up. Please try and assist me.
    Regards
    Jan

  • Date range error when viewing items purchased on ipad from PC

    When I'm on my PC and open iTunes and sort by date, the latest date to show up is 2011 but I have purchased many items on my ipad since then.  I don't know what happened and why it won't show my recent purchases.  Any suggestions????
    Karen

    You will get a second message saying you won't be charged but if you're concerned, just download a free app, any one will do, first to your iPad, then try to transfer it to your PC. Presumably it won't transfer so then download it again directly through iTunes on your PC and try to transfer again.
    Oh one more thing: did you register your iPad during the initial setup sync? iTunes should have asked you if you wanted to register the iPad now or later. If you picked later, maybe the iPad isn't being recognized by iTunes as an authorized device. I'm not sure my speculation is right because if that were the case, I don't think you should be able to transfer apps from PC to iPad but you can do that. But I'm just throwing out ideas. If you haven't registered the iPad yet, maybe go ahead and do so.
    Message was edited by: Peter Lee
    Message was edited by: Peter Lee

  • Get child nodes and only child nodes from a tree?

    Hi all,
    Relatively simple table
    create table replaced_parts
    old_part_number varchar(7),
    replaced_part_number varchar(7),
    updated_date date
    insert into Replaced_parts values('AAAAA/1', 'BBBBB/1', '2012-Feb-16');
    insert into Replaced_parts values('BBBBB/1', 'FFFFF/1', '2012-Feb-23');
    insert into Replaced_parts values('YYYYY/3', 'ZZZZZ/3', '2012-Mar-17');
    insert into Replaced_parts values('FFFFF/1', 'LLLLL/1', '2012-Mar-18');
    insert into Replaced_parts values('LLLLL/1', 'HHHHH/1', '2012-Mar-19');The question is how do I issue a select using 'AAAAA/1' and get the result 'HHHHH/1'
    i.e. (A... -> B, B->F, F->L, L->H)
    and select using 'YYYYY/3' to get 'ZZZZZ/3' (Y... ->Z)?
    It would be really nice if I could also get my original value, say, 'CCCCC/1' if there is no entry
    for 'CCCCC/1' in the replaced_parts table (maybe NVL?).
    I have googled and tried various combinations of CONNECT BY, PRIOR, ISLEAF... &c. but
    am beating my head off a brick wall at the moment.
    TIA,
    Paul...

    >
    Hi, Paul,Hi again Frank - couldn't sleep and am back at the "£$%^&* computer...
    Yeah - it's a pity they weren't correct - I'll make doubly sure in future - see
    my edited post (with DROP TABLE commands inter alia - I also removed
    Order_Parts.User_Number since it was redundant - all that's needed is
    Order_Number (normalisation) so now your SQL doesn't work - sorry
    about that.
    Just saying something "doesn't work" isn;t very helpful. What exactly is wrong with the SQL
    statements I posted? Point out a couple of places where they are wrong, and explain how
    you get the right results in those places.Nothing is wrong with your SQL - I meant *sorry* about the confusion in the DDL/DML from my end.
    Now, I'm sorry again about the ambiguity of my English.
    I'll reconstruct the original data that I gave you and re-run your SQL against that data - again,
    this is *totally* my fault.
    My tables creation script seems to work fine now - I've edited my reponse to Solomon - the definitive scripts
    are now there - with Order_Parts.User_Number gone and the TO_DATE(...) as
    you suggested - the VARCHARs seemed to give the right result though - but I
    agree that if there's a correct way of doing it, then it should be done that way.
    Remember why you need to go to the trouble of posting CREATE TABLE and INSERT statements
    for some sample data here. It's to allow the people who want to help you to re-create the prolem
    and test their ideas. I know, and that's why I did it - the OR REPLACE that I added (stupidly and without thinking or testing) was
    so that people wouldn't have to go to the trouble of dropping the tables - I have now added
    DROP TABLE blah... to the beginning of the script so it won't be necessary.
    I have over 600 posts on this forum and only 26 questions - most of my time
    spent here is trying to help (to the best of my limited ability - I'm not a guru
    like yourself) and learning - it's amazing the number of times problems that
    I've seen here have subsequently arisen at work - and I am frequently
    frustrated by some posters' inability to explain their problem or at least give test
    cases.
    I can forgive bad English (except my own) - not everybody is a fluent speaker of the language,
    but SQL should run no matter what language one speaks.
    I appreciate that people are volunteering their time and effort here and I really do
    try and make it as easy as possible for them when I ask questions - I messed up
    this time, I'm afraid. It might also be the fact that I'm moving between SQL*Plus
    and SQL Developer and a text editor that I got confused (plus, fatigue didn't help...)
    In general, other people are not going to test anything on your system. I'm going to test
    things on my system, Solomon will test things on his system, and other people will test things
    on other systems. Well, if ever you're in Dublin ;). Again, I appreciate the effort that you, Solomon and sKr have
    gone to in helping me.
    Your INSERT earlier statements did not work on my system, because you were using a VARCHAR2
    in a place where a DATE was required. The correct thing to do is to use DATEs where DATEs are required. Indeed, and I agreed with you that if there's a right way of doing it, then it should be done that way.
    If your NLS settings are such that this is not causing you any errors right now, it's still a good
    idea for you to fix it; but, at any rate, whether it works on your system isn't what's important in
    this case; you're posting it to run on other peoples' systems.Ahhh.... <the blinding light of a moment of epiphany descends on Paul> I didn't realise it was
    an NLS setting - of course Americans will be different - it's just that I thought that YYYY-Mon-DD
    worked everywhere (I tried to avoid the day-first/month-first pitfall ) but now that you've explained
    it to me, I'll *never* make that mistake again.
    Yes - my mistake - I've now corrected the error
    Where are the desired results? Don't merely hide them in an old message; post them in a new message.OK. I'll put it in a reply to this post. I really am endeavouring to be as clear as possible - please
    excuse my errors - I will do better in future. I'm also very annoyed at my own incompetence and at
    having put you to more trouble than you would have had to go to if I had my wits about me.
    - should I keep Order_Parts.User_Number even
    if it isn't conformant to normalisation rules?
    If you have a good reason, it's okay to store de-normalized data. For example, some address tables in
    the US contain both state and ZIP code, even though state is fucntionally depenedent on ZIP code. I think that in this case, denormalisation is not called for.
    Re. the ZIP code thing, yeah, sure AIUI, the first two digits are dependent on the state, but the
    last three? They're more or less random - at least in the sense that there's no way to type
    in an address and calculate (mathematically, using a formula) them - so unless one were
    to have weird SQL lookups to a "State" table for the first two digits and then take the final
    three from a user-entered string field, then do a TO_CHAR on the returned 2-digit state number and add
    this to the 3-character one - I can't see how the ZIP code is an example of this? But, maybe
    (unless you wish to discuss that) we're getting side-tracked. Perhaps I'll ask this question
    on comp.databases.theory?
    Oracle actually added a new feature in version 11 (virtual columns) to make de-normalizing easier.Hmmm... is adding virtual columns denormalisation per se? My favourite "cheap'n'cheerful"
    db server (Firebird) has had a COMPUTED BY clause (same idea) for yonks (> 12yrs) - no data
    is actually stored - rather it is calculated on the fly. Another one for comp.databases.theory
    perhaps?
    BTW, wouldn't triggers remove all this hassle? It was my first idea, but trying to do it
    purely through SQL is now *obsessing* me ;)
    That would be another example of de-normalization. If the benefits of doing that outweigh the
    costs, then go ahead. A trigger will take some effort to maintain, and it will make all DML slower, regardless
    of how often that derived value is needed. Having the extra column will make some queries simpler and faster. Disk is cheap. Have an Original_Orders table (never changes) and a Revised_Orders table. When
    a part replacement occurs - for orders that haven't been fulfilled (boolean flag?), change the
    old part number to the new one. I can't imagine that replacement occurs very frequently, so
    the expense of a trigger would IMHO be minimal - plus the down side of any trigger would
    be mitigated by greatly simplifying the production of the Revised_Orders report?
    ... I'll experiment with what you've given me so far - but it's 23:40 here now, so I won't
    get a chance to do it tonight - unfortunately, I *do* have to sleep.
    If you haven't tested it yet, why did you start this message saying "your SQL doesn't work"?Sorry - what I meant was it obviously doesn't work when this eejit (i.e. me) has changed
    the table structure - I did run it quickly (your 1st statement) against the (revised table
    structure, the one you hadn't seen and I don't think even a man of your great SQL talents
    can be expected to write working queries against unknown table structures :)).
    Again, thanks for your help so far - I'll post the *_correct_* DDL and DML as a reply to this post
    with the desired result. I'll also reconstitute the old (i.e. the one you worked against) tables
    and data and let you know - again as a reply to this post - if I can at least learn something
    from my fiasco, it won't have been a total waste of my time, and again, apologies for
    wasting yours.
    Thanks again and rgs.
    Paul...
    Edited by: Paulie on 22-Mar-2012 02:50

  • How to retrieve a child node's immediate parent node from a tree table?

    Hello
    Hi,
    I have a category_subcategories table, and I would like to know how to construct a sql and sub-sql for retrieving a child node's immediate parent node.
    Here is my first part of the sql, it only returns the node "Flash"'s parent and its grand-parents:
    SELECT parent.category_name, node.lft, node.rgt
    FROM category_subcategories AS node,
    category_subcategories AS parent
    WHERE node.lft > parent.lft AND node.lft < parent.rgt
    AND node.category_name = 'FLASH'
    ORDER BY parent.lft;
    | name |
    | ELECTRONICS |
    | PORTABLE ELECTRONICS |
    | MP3 PLAYERS | |
    how can I modify this query so that it returns Flash' parent - 'MP3 Players'?
    Thanks a lot
    Sam

    Hi,
    This is an Oracle forum. If you're not iusing Oracle, make that clear. Always say what version of your softwate you're using, whether it's Oracle or anything else.
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data. Explain how you get those results from that data.
    It looks like you're using the Nested Sets technique for modeling a tree. To get the parents of given nodes, do something like this:
    SELECT        parent.category_name
    ,       node.lft
    ,       node.rgt
    FROM        category_subcategories      node     -- Can't use AS with table alias in Oracle
    ,       category_subcategories      parent
    WHERE        parent.lft      IN (
                        SELECT     MAX (lft)
                        FROM     category_subcategories
                        WHERE     lft     < node.lft
                        AND     rgt     > node.rgt
    AND        node.category_name          = 'FLASH'
    ORDER BY  parent.lft; This should work in Oracle 8.1 and up. (I can't actually test it unless you post CREATE TABLE and INSERT statements for some sample data). You may need to modify the syntax a little for your database.
    785102 wrote:
    Hello,
    I tried to implement the solution as follow:
    mysql> select parent.*
    -> from category_subcategories as parent
    -> having parent.lft =
    -> (select max(parent.lft) from
    -> (SELECT parent.category_name, parent.lft, parent.rgt
    -> FROM category_subcategories AS node,
    -> category_subcategories AS parent
    -> WHERE node.lft > parent.lft AND node.lft < parent.rgt
    -> AND node.category_name = 'Sofa'
    -> ORDER BY parent.lft
    -> )
    -> );
    ERROR 1248 (42000): Every derived table must have its own alias
    mysql>
    But I got an error.
    What is wrong with it?What does the error message say?
    Apparantly, in your system (unlike Oracle), every sub-query must have a name. Try something like this:
    select      parent.*
    from      category_subcategories as parent
    having      parent.lft = (
                   select      max(parent.lft)
                   from     (
                             SELECT        parent.category_name
                             ,       parent.lft
                             ,       parent.rgt
                             FROM        category_subcategories      AS node,
                                    category_subcategories      AS parent
                             WHERE        node.lft      > parent.lft
                             AND        node.lft      < parent.rgt
                             AND        node.category_name = 'Sofa'
                             ORDER BY  parent.lft     -- Is this a waste of effort?
                        )  AS got_name_lft_and_rgt
                  )     AS got_lft
    ;What is the purpose of having the inner sub-query, the one I called got_name_lft_and_rgt?
    Also, in Oracle, an ORDER BY clause in a sub-query doesn;t guarantee that any super-queries will keep that order. Why do you have an ORDER BY clause in the sub-query, and not in the main query?

Maybe you are looking for