Frm-47313 Invalid Query for Hierarchy tree

Hello. i am trying to create a hierarchy tree with the following query:
SELECT 1, level, n.name, null, hn.nde_id
FROM cerpt_nodes n, cerpt_hierarchy_nodes hn
WHERE n.id = hn.nde_id
AND hn.hir_id = 1
CONNECT BY PRIOR hn.nde_id = hn.nde_id_parent_of
START WITH hn.ntp_code='ROOT';
I check the table and column names, they are correct. I tried to create tree with scott.emp table, I have no problem. The only different is this query has nested tables and where clause. Is that I cannot use WHERE clause and nested tables? Can anybody tell me what I have done wrong? Thank you very much

I had problems with joins in the same SQL statement using the Connect Prior By statement. Try creating a view over your nested tables then create the SQL statement for the tree using the view.
I ended up having a lot of problems using the tree control. I ended up modifing my database design to accomodate the short falls of the Connect Prior By statement.
Hope this helps.
Jamie

Similar Messages

  • Query for hierarchical tree

    I am trying to build a hierarchical tree and tried various option but is unable to show the tree. I have tried using record group and also query text. When I used
    Ftree.Set_Tree_Property(htree, Ftree.query_text, 'SELECT 1, hierarchy_level, hierarchy_code, '', hierarchy_desc FROM oms_cust_hierarcy_tree_vw
    connect by prior hierarchy_code = hierarchy_parent
    start with hierarchy_parent is null');
    I got following error:
    "FRM-47313: invalid query for hierarchical tree".
    I am stuck now. Any help will be appreciated.
    Thanks
    Brinder

    dear member try this query
    SQL>
    1 SELECT level, LPAD(' ',2*level-2)||emp.ename ename, emp.empno, emp.mgr, emp.deptno
    2 FROM Emp
    3 CONNECT BY PRIOR emp.empno = emp.mgr
    4* START WITH emp.empno = 7839
    SQL> /
    LEVEL ENAME EMPNO MGR DEPTNO
    1 KING 7839 10
    2 BLAKE 7698 7839 10
    3 MARTIN 7654 7698 10
    3 ALLEN 7499 7698 10
    3 TURNER 7844 7698 10
    3 JAMES 7900 7698 10
    3 WARD 7521 7698 10
    2 CLARK 7782 7839 10
    3 MILLER 7934 7782 10
    2 JONES 7566 7839 10
    3 FORD 7902 7566 10
    4 SMITH 7369 7902 10
    5 Ken 999 7369 10
    3 SCOTT 7788 7566 10
    4 ADAMS 7876 7788 10
    M Rizwan

  • Htree - many hours later still getting "invalid query for htree"

    I'm using the Pre_Form trigger ftree.populate_tree('HTREE_BLK.TREE4'); and the query you see below. I am still getting "FRM-47313: Invalid query for the hierarchical tree". I must be missing something because I don't see what is wrong with the query.
    greg
    SQL> select
    2 decode(level, 1, 1, -1)
    3 ,level
    4 ,description
    5 ,null
    6 ,menu_id
    7 from htree_menu
    8 start with belongs_to is null
    9 connect by prior
    10 menu_id = belongs_to;
    DECODE(LEVEL,1,1,-1) LEVEL DESCRIPTION N MENU_ID
    1 1 Retired Profit Sharing System 1
    -1 2 Screens 2
    -1 3 Main 5
    -1 3 Search 6
    -1 2 Processing 3
    -1 3 Apply Interest 7
    -1 3 Calculate Quarterly Payments 8
    -1 3 Six Month Projections 9
    -1 2 Reports 4
    -1 3 Summary Report 10
    -1 3 Monthly Payments 11
    DECODE(LEVEL,1,1,-1) LEVEL DESCRIPTION N MENU_ID
    -1 3 Participant Listing 12
    -1 3 Participant Quarterly Report 13
    -1 3 Six Month Projection 14
    14 rows selected

    I tried this select on the SCOTT schema:
    select decode(level,1,1,-1),level,ename,null,empno from emp connect by prior empno=mgr start with mgr is null
    In a pre-form in Oracle9i Forms and it works for me.
    Check this select in your case.
    Make sure that you don't have any extra characters in the select (";")

  • FRM-40212: Invalid value for Field SHIP_TO_ADDRESS1on forms OEXOETEL

    I want to customize a form "OEXOETEL". I want to copy some values from another order to a new order.When i navigate to a block LINE i receive this message: "FRM-40212: Invalid value for Field SHIP_TO_ADDRESS1".
    cursor c_order(p_header_id varchar2) is
    select o.sold_to,
    o.order_type,
    o.terms,
    o.ship_from,
    o.SHIP_to_org_id,
    o.ship_to_address1,
    o.ship_to_address5,
    o.customer_number,
    o.invoice_to_org_id,
    o.INVOICE_TO_LOCATION,
    o.SHIP_TO_LOCATION,
    o.invoice_to_address1,
    o.invoice_to_address5,
    o.sold_to_contact
    from oe_order_headers_v o,
    hz_parties hzp
    where hzp.party_name = o.sold_to
    and o.header_id = p_header_id;
    IF l_block_name IN ('ORDER') THEN
    IF p_event = 'WHEN-NEW-RECORD-INSTANCE' THEN
    open c_order(name_in('global.header_id'));
    loop
         fetch c_order into x_order_row;
    exit when c_order%notfound;
         copy(x_order_row.customer_number,'ORDER.CUSTOMER_NUMBER');
         copy(x_order_row.sold_to,'ORDER.SOLD_TO');
    copy(x_order_row.ship_to_org_id,'ORDER.SHIP_TO_ORG_ID');
    copy(x_order_row.SHIP_TO_LOCATION,'ORDER.SHIP_TO_LOCATION');
         copy(x_order_row.ship_to_address5,'ORDER.SHIP_TO_ADDRESS5');
    copy(x_order_row.ship_to_address1,'ORDER.SHIP_TO_ADDRESS1');
    copy(x_order_row.ship_to_address1,'ORDER.SHIP_TO_ADDRESS1_MIR2');
         copy(x_order_row.invoice_to_org_id,'ORDER.INVOICE_TO_ORG_ID');
         copy(x_order_row.invoice_TO_LOCATION,'ORDER.INVOICE_TO_LOCATION');
         copy(x_order_row.invoice_to_address5,'ORDER.INVOICE_TO_ADDRESS5');
    copy(x_order_row.invoice_to_address1,'ORDER.INVOICE_TO_ADDRESS1');
    copy(x_order_row.INVOICE_TO_LOCATION,'ADDRESSES.INVOICE_TO_LOCATION');
         copy(x_order_row.order_type,'ORDER.ORDER_TYPE');
         copy(x_order_row.sold_to_contact,'ORDER.SOLD_TO_CONTACT');
         copy(x_order_row.ship_from,'ORDER.SHIP_FROM');
    end loop;
    close c_order;
    end if;
    end if;

    Review Note: 302613.1 - OEXOEORD: Cannot select List of Values From The Ship To Address1 Field
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=302613.1

  • Hierarchy Query For Full Tree ?

    Hi Everyone,
    I want to write a hierarchy query which should give me the whole path starting from root node to each individual nodes by passing value of any individual tree member. below is the sample data and the output what i am expecting. and also the output what i am getting right now from my query.
    CREATE TABLE RELATION (PARENT VARCHAR2(1),CHILD VARCHAR2(1) PRIMARY KEY);
    --Data for the tree which starts from the root 'A'
    Insert into RELATION (PARENT, CHILD) Values (NULL,'A');
    Insert into RELATION (PARENT, CHILD) Values ('A', 'B');
    Insert into RELATION (PARENT, CHILD) Values ('A', 'C');
    Insert into RELATION (PARENT, CHILD) Values ('B', 'D');
    Insert into RELATION (PARENT, CHILD) Values ('B', 'E');
    Insert into RELATION (PARENT, CHILD) Values ('D', 'F');
    Insert into RELATION (PARENT, CHILD) Values ('C', 'G');
    --Data for the tree which starts from the root 'H'
    Insert into RELATION (PARENT, CHILD) Values (NULL,'H');
    Insert into RELATION (PARENT, CHILD) Values ('H', 'I');
    Insert into RELATION (PARENT, CHILD) Values ('H', 'J');
    Expected Output by passing values as 'C' which gives the whole tree where the node C is present:
    A
    A->B
    A->C
    A->B->D
    A->B->E
    A->C->G
    A->B->D->F
    My Query:
    select
    sys_connect_by_path(child,'->') tree
    from
    relation
    --where (parent ='C' or child='C') 
    start with
    parent is null
    connect by
    prior child = parent
    order by tree;
    Output of my query:
    ->A
    ->A->B
    ->A->B->D
    ->A->B->D->F
    ->A->B->E
    ->A->C
    ->A->C->G
    ->H
    ->H->I
    ->H->J
    I am not able to add the condition for the query so that i can get only rows of the tree where the nod 'C' is present. i am just getting whole data from the table with all the unwanted trees.
    Can anyone please help me in getting the correct output.
    Thank you in advance.

    odie_63 wrote:
    Another solution, involving analytics : Hierarchical queries and analytic functions do not mix well together in 10g:
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> SELECT tree
      2  FROM (
      3    select sys_connect_by_path(child,'->') tree,
      4           max(case when child = 'C' then connect_by_root(child) end) over() root1,
      5           connect_by_root(child) root2
      6    from relation
      7    start with parent is null
      8    connect by prior child = parent
      9  )
    10  WHERE root1 = root2
    11  ;
      from relation
    ERROR at line 6:
    ORA-00600: internal error code, arguments: [qctcte1], [0], [], [], [], [], [], []
    SQL> Although it is much better in 11g:
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> SELECT tree
      2  FROM (
      3    select sys_connect_by_path(child,'->') tree,
      4           max(case when child = 'C' then connect_by_root(child) end) over() root1,
      5           connect_by_root(child) root2
      6    from relation
      7    start with parent is null
      8    connect by prior child = parent
      9  )
    10  WHERE root1 = root2
    11  ;
    TREE
    ->A
    ->A->B
    ->A->B->D
    ->A->B->D->F
    ->A->B->E
    ->A->C
    ->A->C->G
    7 rows selected.
    SQL> SY.

  • Need to write SQL query for hierarchy

    Hi Guys,
    I need help to write a query for the below scenario.
    I have one organization, under that I have many branches. when i provide input to query on last branch, i need to display all parents of that branch like below
    Organization   ---parent
      branch 1  ---child
         branch11
         branch 12
        branch 2   ---child
          branch 21
         branch 3 ----child
          branch 31
          branch 32
          branch 33
    here, when i provide input as branch 3, then I need to fetch results branch 2, branch 1 till organization.
    can any one help me on this.
    Thanks in advance!
    Regards,
    LKR

    Hi,
    Is this the same question as
    https://community.oracle.com/thread/2616828
    Please don't post the same question over and over.  Mark this thread as "Answered" right away, and continue in the other thread (if necessary; the other thread has answers.)

  • Plz help me in this query for the tree

    hi All
    I want to bulid tree that start with for example
    schema name "scott"
    then table "dept,emp
    then ename in table emp
    root scott
    parent dept
    child emp_name
    please help me in the query ?

    user222 wrote:
    any help my dearsIf you can draw one simple tree example. Then it will be easy to create query. Because i am confuse about the output. Just draw one example of your desired output tree. Then it will help to find solution.
    And while writing query or any example so use the 6 digit before and after your query or example to keep the formatting in orignal format. Otherwise it becomes hard to read.
    For more information see FAQ on right corner for page.
    -Ammad                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Update Query For Hierarchy Table

    Hi All
    I have a Hierarchy table that has news categories. I want use a query than when user deactivate a category, all child category has been deactivated. For example
    1- Politics
    1-1- National Politics
    1-2- International Politics
    1-2-1- Asia
    1-2-2- Africa
    2- Economic
    If Politics has been deactivated, all child must be deactivate. (1-1, 1-2, 1-2-1, 1-2-2)
    Please help me
    With Best Regards

    This is table structure script:
    SET NUMERIC_ROUNDABORT OFF
    GO
    SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON
    GO
    IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID('tempdb..#tmpErrors')) DROP TABLE #tmpErrors
    GO
    CREATE TABLE #tmpErrors (Error int)
    GO
    SET XACT_ABORT ON
    GO
    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    GO
    BEGIN TRANSACTION
    GO
    PRINT N'Creating schemata'
    GO
    PRINT N'Creating [dbo].[Modules]'
    GO
    CREATE TABLE [dbo].[Modules]
    [Module_ID] [int] NOT NULL,
    [ModuleName] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [ModuleTitle] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Status] [int] NULL
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    PRINT N'Creating primary key [PK_Modules] on [dbo].[Modules]'
    GO
    ALTER TABLE [dbo].[Modules] ADD CONSTRAINT [PK_Modules] PRIMARY KEY CLUSTERED ([Module_ID])
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    PRINT N'Creating [dbo].[Categories]'
    GO
    CREATE TABLE [dbo].[Categories]
    [Category_ID] [int] NOT NULL IDENTITY(1, 1),
    [Module_ID] [int] NOT NULL,
    [ParentID] [int] NULL,
    [Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Title] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Priority] [int] NULL,
    [ThumbnailImage] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Status] [int] NULL
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    PRINT N'Creating primary key [PK_Categories] on [dbo].[Categories]'
    GO
    ALTER TABLE [dbo].[Categories] ADD CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED ([Category_ID])
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    PRINT N'Adding foreign keys to [dbo].[Categories]'
    GO
    ALTER TABLE [dbo].[Categories] ADD CONSTRAINT [FK_Categories_Modules] FOREIGN KEY ([Module_ID]) REFERENCES [dbo].[Modules] ([Module_ID])
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    IF EXISTS (SELECT * FROM #tmpErrors) ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT>0 BEGIN
    PRINT 'The database update succeeded'
    COMMIT TRANSACTION
    END
    ELSE PRINT 'The database update failed'
    GO
    DROP TABLE #tmpErrors
    GO
    This is table data
    SET NUMERIC_ROUNDABORT OFF
    GO
    SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS, NOCOUNT ON
    GO
    SET DATEFORMAT YMD
    GO
    SET XACT_ABORT ON
    GO
    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    GO
    BEGIN TRANSACTION
    -- Pointer used for text / image updates. This might not be needed, but is declared here just in case
    DECLARE @pv binary(16)
    PRINT(N'Drop constraints from [dbo].[Categories]')
    GO
    ALTER TABLE [dbo].[Categories] DROP CONSTRAINT [FK_Categories_Modules]
    PRINT(N'Add 14 rows to [dbo].[Categories]')
    GO
    SET IDENTITY_INSERT [dbo].[Categories] ON
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (1, 1, NULL, 'News', N'اخبار', 1, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (2, 2, NULL, 'Article', N'مقالات', 2, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (3, 3, NULL, 'Galleries', N'گالری', 3, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (4, 1, 1, 'Politics', N'سیاسی', 1, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (5, 1, 1, 'Economic', N'اقتصادی', 2, '', 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (6, 1, 4, 'NationalPilitics', N'سیاست داخلی', 1, '', 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (7, 1, 4, 'InternationalPolitics', N'سیاست خارجی', 2, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (8, 1, 7, 'Asia', N'آسیا', 1, '', 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (9, 1, 7, 'Europe', N'اروپا', 2, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (10, 1, 7, 'Africa', N'آفریقا', 3, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (11, 2, 2, 'Scientic', N'علمی', 1, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (12, 2, 2, 'Art', N'هنری', 2, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (13, 3, 3, 'Culture', N'فرهنگی', 1, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (14, 3, 3, 'Religion', N'مذهبی', 2, NULL, 1)
    SET IDENTITY_INSERT [dbo].[Categories] OFF
    PRINT(N'Add constraints to [dbo].[Categories]')
    GO
    ALTER TABLE [dbo].[Categories] ADD CONSTRAINT [FK_Categories_Modules] FOREIGN KEY ([Module_ID]) REFERENCES [dbo].[Modules] ([Module_ID])
    COMMIT TRANSACTION
    GO
    Thanks for your help

  • Restriciting BI query for Hierarchy authorization for a defined group

    Hi Friends
    We are trying to restrict the Display with respect to the company codes group.
    We have defined the authoirzation for BI w.r.t to the company code and groups ( collection of co.codes ) ..We have defined the authoirzation object under Rsecadmin and restricted the display for only group eg: GH3 . However when we ran the query we can see all the companies / groups. Also tried with putting the GHR group under Hierarchy authorization but still have the same result.
    Can you please let me know what is going wrong
    thank for all your help..

    We have defined the authoirzation for BI w.r.t to the company code and groups ( collection of co.codes ) ..We have defined the authoirzation object under Rsecadmin and restricted the display for only group eg: GH3 .
    Did you check if the infoprovider(s) which your query is hitting upon has company code and company groups checked as authorization relevant in RSA1?
    Thanks
    Sandipan

  • Problem with pictures for hierarchy trees

    Hello
    I get a problem with tiles involving trees :
    For example in the "pascategoryselect" tile, method "InitializeTree" :
            .LabelEdit = 1
            .Images.Add 1, "", LoadPicture(ResourcePath + "FolderClosed.gif")
            .Images.Add 2, "", LoadPicture(ResourcePath + "FolderOpen.gif")
            .Images.Add 3, "", LoadPicture(ResourcePath + "Leaf.gif")
            .Images.Add 4, "", LoadPicture(ResourcePath + "Iba_comp_prod.gif")
            .Nodes.Clear
    The '.Image.Add ..." lines crash, the Err.Description statement is "Automation Error, Catastrophic failure" (Err.Number = -2147418113)
    I have looked for the RessourcePath and file requested, all exist.
    For the moment here is my "workaround"
            .LabelEdit = 1
    on error resume next
            .Images.Add 1, "", LoadPicture(ResourcePath + "FolderClosed.gif")
            .Images.Add 2, "", LoadPicture(ResourcePath + "FolderOpen.gif")
            .Images.Add 3, "", LoadPicture(ResourcePath + "Leaf.gif")
            .Images.Add 4, "", LoadPicture(ResourcePath + "Iba_comp_prod.gif")
    on error goto 0
            .Nodes.Clear
    Have anyone ever had this problem ? How can I solve it ?
    Some other trees (don't remember which though) load without problem and the FolderClosedand FolderOpenimages are displayed....
    Thanks and Regards,
    François

    Thanks Markus, you're right I forgot to mention it : I am using version 4 with SP8.
    I will have to try again to confirm this but I think it also happens in the generated application (basically, the erro is caught by the calling method, and the tile appear empty)
    Regards,
    François

  • Query for Hierarchy Path from child to parent for a given child key by user

    CREATE TABLE EMP_ID
      HEAD_ID  NUMBER(4),
      TAIL_ID  NUMBER(4),
      NAME     VARCHAR2(20 )
    Insert into EMP_ID  Values  (1011, 1008, 'C11');
    Insert into EMP_ID  Values  (1008, 1003, 'C8');
    Insert into EMP_ID  Values  (1012, 1003, 'C12');
    Insert into EMP_ID  Values  (1020, 1003, 'C20');
    Insert into EMP_ID  Values  (1025, 1003, 'C25');
    Insert into EMP_ID  Values  (1015, 1012, 'C15');
    Insert into EMP_ID  Values  (1012, 1005, 'C12');
    Insert into EMP_ID  Values  (1005, 1017, 'C5');
    COMMIT;now my requirement is like this
    if choose the head_id as 1012 and tail_id as 1017
    it should traverse the path form tail to head and print the path as shown below
    c12/c5/c17/c12such that it shows that tail_id has been used as head_id in the same hierarchy path previously.
    here the hierarchy is as shown below
    1015
          1012
                1005
                    1017

    Rede,
    Is this what you want?
    CREATE TABLE EMP_ID
      HEAD_ID  NUMBER(4),
      TAIL_ID  NUMBER(4),
      NAME     VARCHAR2(20 )
    Insert into EMP_ID  Values  (1011, 1008, 'C11');
    Insert into EMP_ID  Values  (1008, 1003, 'C8');
    Insert into EMP_ID  Values  (1012, 1003, 'C12');
    Insert into EMP_ID  Values  (1020, 1003, 'C20');
    Insert into EMP_ID  Values  (1025, 1003, 'C25');
    Insert into EMP_ID  Values  (1015, 1012, 'C15');
    Insert into EMP_ID  Values  (1012, 1005, 'C12');
    Insert into EMP_ID  Values  (1005, 1017, 'C5');
    Insert into EMP_ID  Values  (1017, 1012, 'C17');  ---- ==== This was missing in your setup example
    COMMIT;QUERY and OUTPUT
    SELECT *
      FROM (
    select
      connect_by_iscycle as CYC
    ,dt.head_id
    ,dt.tail_id                     
    ,sys_connect_by_path
                      (  dt.name
                      ) AS EMP_PATH                   
    from   emp_id dt
    start with dt.head_id = 1012
    connect by  NOCYCLE  dt.head_id= prior dt.tail_id)
    CYC     HEAD_ID     TAIL_ID     EMP_PATH
    0     1012     1003     /C12
    0     1012     1005     /C12
    0     1005     1017     /C12/C5
    1     1017     1012     /C12/C5/C17
    0     1012     1003     /C12/C5/C17/C12If you just want the PATH printed
    SELECT *
      FROM (
    select     
    max(sys_connect_by_path
                      (  dt.name
                      )) AS EMP_PATH                   
    from   emp_id dt
    start with dt.head_id = 1012
    connect by  NOCYCLE  dt.head_id= prior dt.tail_id)
    /C12/C5/C17/C12vr,
    Sudhakar B.

  • FRM-47313

    Hi all,
    I work in Forms 6.0.
    I have constructed an tree item and I used a query to populate it.
    The format of query is:
    select 1,level,ename,null,to_char(empno)
    from emp
    connect by prior empno=mgr
    start with MGR IS NULL
    I used the apropriate PRE-BLOCK trigger:
    declare
         htree item;
    begin
         --Find the tree itself.
         htree:=find_item('tree_block.tree_item');
         --Populate the tree with data.
         ftree.populate_tree(htree);
    end;
    And all works fine.
    But, I gave the form module to a friend and he sais
    that receives the FRM-47313 error message.
    What could be the cause?
    Thanks in advance,
    Eugen

    Eugen,
    'FRM-47313: Invalid query for the hierarchical tree' was not documented in the Form builder Help Topics.
    This is a new error message since D2K 6.0 hierarchical tree (htree)object.
    The format of the query must have to have the following format:
    4 column format:
    Initial State NUMBER values 1, -1, 0
    node tree depth NUMBER values starting at 1 and increasing by 1
    for children
    node label VARCHAR2 max 256 ( truncated without error )
    node icon name VARCHAR2 max 256 ( truncated without error )
    An example query:
    select initial_state, node_tree_depth, node_label, node_icon_name
    from my_tree_data_table
    If the tree works for you, then still there can be a problem with the database (or table) that your friend uses.
    Fran

  • 11.5.9: APXINWKB  FRM-40212: INVALID VALUE

    제품 : FIN_AP
    작성날짜 : 2004-10-14
    11.5.9: APXINWKB FRM-40212: INVALID VALUE
    ==========================================
    PURPOSE
    11.5.9 INVOICE WORKBENCH에서 나타나는 문제를 해결하기 위해 작성했습니다.
    Problem Description
    11.5.9 에서 Prepayment에 Apply된 invoice 의 Distribution Button을 눌렀을때 다음과 같은 Error Message 가 발생한다.
    FRM-41050: You cannot update this record
    FRM-40212: Invalid value for field REQUESTER_NAME
    Workaround
    11.5.9 에서는 다음과 같이 manual하게 작업을 해주어야한다.
    @ 01. Please make a backup copy of the $AP_TOP/forms/US/apxinwkb.fmb file.
    @ 02. Open the new file in Forms Builder, and navigate to Program Units.
    @ 03. Select the INV_SUM_FOLDER_ITEM_OVERFLOW package Body.
    @ 04. Find the requester_name_display procedure. It should show as follows:
    @ procedure requester_name_display (event varchar2) is
    @ begin
    @ if (event in ('INIT',
    @ 'WHEN-NEW-RECORD-INSTANCE',
    @ 'POST-QUERY')) then
    @ IF :inv_sum_folder.requester_id is not null THEN
    @ SELECT full_name
    @ INTO :inv_sum_folder.requester_name
    @ FROM per_all_people_f pap
    @ WHERE person_id = :inv_sum_folder.requester_id
    @ AND :inv_sum_folder.invoice_date >= pap.effective_start_date
    @ AND :inv_sum_folder.invoice_date <= nvl(pap.effective_end_date,sysdate);
    @ END IF;
    @ else
    @ message('Invalid event passed to requester_name_display');
    @ Raise Form_Trigger_Failure;
    @ end if;
    @ end requester_name_display;
    @ 05. Insert the set_item_property statement so the code now is updated to:
    @ procedure requester_name_display (event varchar2) is
    @ begin
    @ if (event in ('INIT',
    @ 'WHEN-NEW-RECORD-INSTANCE',
    @ 'POST-QUERY')) then
    @ IF :inv_sum_folder.requester_id is not null THEN
    @ SELECT full_name
    @ INTO :inv_sum_folder.requester_name
    @ FROM per_all_people_f pap
    @ WHERE person_id = :inv_sum_folder.requester_id
    @ AND :inv_sum_folder.invoice_date >= pap.effective_start_date
    @ AND :inv_sum_folder.invoice_date <= nvl(pap.effective_end_date,sysdate);
    @ END IF;
    @ --Bug 2621328
    @ set_item_property('INV_SUM_FOLDER.requester_name',
    @ ITEM_IS_VALID,
    @ PROPERTY_TRUE);
    @ else
    @ message('Invalid event passed to requester_name_display');
    @ Raise Form_Trigger_Failure;
    @ end if;
    @ end requester_name_display;
    @ 06. Save the changes and recompile the form.
    @ 07. Test the changes.
    Solution Description
    공식적인 해결책은 Fin_PF.E를 적용하는 것이다.
    Reference Documents
    Note 272982.1

    When I update fnd_profile.value('ORG_ID') of the sql of lov to a specific value org_id(for example 120),
    then compile the form. After creating a record, to return back to find window ,the item of lov can show record.
    So I think that it have not get value from fnd_profile.value('ORG_ID') after creating a record.
    Why is this?
    Thanks.

  • FRM-47321: Data used to populate tree is invalid

    FRM-47321: Data used to populate tree is invalid
    I am populating from a record group
    Any Suggestion will be appreciated

    Hi, Ahmed!
    I have created htree using Data Query. For table POM with columns POM_ID, POM_IDH, NAME, and data:
    POM_ID POM_IDH NAME
    1||     || Name1
    2||     1||     Name2
    3||     1||     Name3
    and code in when new form instance trigger:
    ftree.Set_Tree_Property(
         'T1',
         ftree.Query_Text, 'SELECT -1, LEVEL, NAME, NULL, POM_ID
    FROM POM
    START WITH POM_IDH IS NULL
    CONNECT BY PRIOR POM_ID=POM_IDH');
    where 'T1' is name of htree.
    BR,
    Goran

  • DataTabe ExecuteQuery - Invalid Query Tree [300-33]

    HI,
    Like the subject suggest,
    when I try to execute a store procedure with executeQuery method from Grid Object, the calling of this method return me the subject error (Invalid Query Tree [300-33])
    but under "SQL Managment Studio" it works fine.
    For information the store procedure produce not many records about 30000 and it create TEMP TABLE, CURSOR etc..etc..
    How can i solve? Because the store procedure run correctly under "SQL Managment Studio".
    Best regards

    Hi,
    When you run your stored procedue in SQL Studio Management are there any messages returned (ie in the Messages tab in the results panel)? It can cause errors if there are any warnings returned during the procedure. Also, make sure you are setting nocount on at the start of your procedure and setting it back to off just before you return the recordset that you want to return to SBO.
    Kind Regards,
    Owen

Maybe you are looking for