Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

avoiding union

pollywogOct 29 2010 — edited Oct 30 2010
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE	10.2.0.4.0	Production
TNS for HPUX: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
WITH t AS (SELECT 1 id,
                  'A' grp,
                  1 account,
                  'I' TYPE
             FROM DUAL
           UNION ALL
           SELECT 2,
                  'A',
                  1,
                  NULL
             FROM DUAL
           UNION ALL
           SELECT 3,
                  'A',
                  2,
                  NULL
             FROM DUAL
           UNION ALL
           SELECT 4,
                  'B',
                  1,
                  'I'
             FROM DUAL
           UNION ALL
           SELECT 5,
                  'B',
                  1,
                  NULL
             FROM DUAL)
IDGRP   ACCOUNT    TYPE
1   A 1             I
2   A     1
3   A     2
4    B     1          I
5    B     1 
when the account changes per group ( like going from account 1 to account 2) I need an additional row with a type of R
I have the expected results if I use a union
SELECT ID,
       grp,
       account,
       CASE
          WHEN LAG (account) OVER (PARTITION BY grp ORDER BY id) != account
          THEN
             'R'
          ELSE
             TYPE
       END
          TYPE
  FROM t
UNION 
SELECT * FROM t;
ID,GRP,ACCOUNT,TYPE
1 A 1 I
2 A 1
3 A 2 R
3 A 2,
4 B 1 I
5 B 1 
however I'd like to do it without the union
is there a solution using connect by or the model clause or somehting?

Edited by: pollywog on Oct 29, 2010 11:32 AM

Edited by: pollywog on Oct 29, 2010 11:38 AM

Edited by: pollywog on Oct 29, 2010 11:39 AM
This post has been answered by hm on Oct 29 2010
Jump to Answer

Comments

jsmith
Perhaps not the best way to do it, but the following code worked for me if executed after show was called on the stage containing the table.
Pane header = (Pane) table.lookup("TableHeaderRow");
header.setVisible(false);
table.setLayoutY(-header.getHeight());
table.autosize();
892432
Thanks for that lookup ID, that's what I needed.

I did the following, and it worked:
list.widthProperty().addListener(new ChangeListener<Number>()
        {
            @Override
            public void changed(ObservableValue<? extends Number> source, Number oldWidth, Number newWidth)
            {
                ...other stuff...
                
                //Don't show header
                Pane header = (Pane) list.lookup("TableHeaderRow");
                if (header.isVisible()){
                    header.setMaxHeight(0);
                    header.setMinHeight(0);
                    header.setPrefHeight(0);
                    header.setVisible(false);
                }
            }
        });
The resize happens on .show() and so I don't have to worry about when my table is being built.

Is there a "OnShow" event, because that would be a better place for this code... but this works.

Edited by: denis77 on Dec 12, 2011 7:45 AM
User_CDX3F

I've a nested column, i.e. one column has 2 columns in it. How to disable only the header of the sub column and not the main column's header.

Example:

TableColumn main = new TableColumn("");

TableColumn lastName = new TableColumn("Last Name");

TableColumn firstName = new TableColumn("First Name");

main.getColumns().addAll(lastName , firstName );

When this is rendered, it displays 1 main header and 2 sub header Last Name and First Name. Now how to only hide showing of First and Last Name column's header.

Is it possible?

Thanks.

1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 27 2010
Added on Oct 29 2010
9 comments
549 views