ViewCriteria comparing two columns of the table to create

Anyone know how I can create a ViewCriteria where clause that compares the two columns of the same table?

For example if I had two columns of integers (MINSAL and MAXSAL) and wanted to see if they are equal. Normally, I would do the following SQL below.

SELECT * EMPL
WHERE MINSAL = MAXSAL

Try to link any of them to an expression of groovy.

Timo

Tags: Java

Similar Questions

  • How to check the index, on the number of columns in the table is created

    How to check on the number of columns in the table the index has been created. ??

    OR

    How check index, on the number of columns in the table that it is been created?

    890306 wrote:
    How to check on the number of columns in the table the index has been created. ??

    >

    OR

    How check index, on the number of columns in the table that it is been created?

    query USER_IND_COLUMNS

    SQL> desc user_ind_columns
     Name                            Null?    Type
     ----------------------------------------- -------- ----------------------------
     INDEX_NAME                             VARCHAR2(30)
     TABLE_NAME                             VARCHAR2(30)
     COLUMN_NAME                             VARCHAR2(4000)
     COLUMN_POSITION                        NUMBER
     COLUMN_LENGTH                             NUMBER
     CHAR_LENGTH                             NUMBER
     DESCEND                             VARCHAR2(4)
    

    Handle: 890306
    Status level: Beginner
    Join date: October 8, 2011
    Messages total: 13
    Total Questions: 5 (5 open)

    Why all the question still pending?

    Published by: sb92075 on December 3, 2011 17:21

  • Combine the two columns of the table

    SELECT providerid, Sum OF appdev.usercounts
    WHERE the counttime BETWEEN SYSDATE - 30/1440 AND SYSDATE-15/1440 GROUP BY ORDER BY providerid providerid

    697 W
    U 813
    T 143
    S 2

    SELECT providerid, Sum OF appdev.usercounts
    WHERE the counttime BETWEEN - 30/1440 AND (SYSDATE-1) - 15/1440 (SYSDATE-1) GROUP BY ORDER BY providerid providerid;

    450 W
    U 571
    T 80
    S 2

    I want output like

    W 697 450
    U 813 571
    143 80 T
    2 2 S
    Help, please

    Thank you
    Praveen

    'COUNT', which is the actual column name? It could become very confusing.

    Not tested for obvious reasons, but it should be close:

    SELECT providerid
         , sum(
             case when counttime between sysdate - 30/1440 and sysdate - 15/1440 then count end
           ) as cnt1
         , sum(
             case when counttime between (sysdate-1) - 30/1440 and (sysdate-1) - 15/1440 then count end
           ) as cnt2
    FROM appdev.usercounts
    WHERE ( counttime between sysdate - 30/1440 and sysdate - 15/1440 )
       OR ( counttime between (sysdate-1) - 30/1440 and (sysdate-1) - 15/1440 )
    GROUP BY providerid
    ORDER BY providerid
    ;
    
  • compare two columns

    source(emp)
    -----
    ename      d_ename
    --------------------------
    john            john
                      chris
    
    joe                    
    mary            mary
    target table (emp_target)
    --------------------------
    f_ename - must fill in the value function ename and d_ename. compare two columns if the column is null, then take the column which is not null. If the two columns are populated then take all of the column. It will have the same values.

    Please help me how can I have f_ename value in the emp_target table.
    expected output
    
    f_name
    -----
    john   
    chris
    joe     
    mary
    compare two columns
    and take what is not null

    Hello

    Nordine Show, you can use NVL, or the function COALESCE sometimes more fast.

    If you are filling out the table emp_target with the values of the emp table, then you can use NVL (or COALESCE) in an INSERT statement like this:

    INSERT INTO  emp_target (f_name)
    SELECT  COALESCE (ename, d_ename)
    FROM     emp
    ;
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    If you ask a DML statement, such as INSERT, sample data will be the content of the or the tables before the DML, and the results will be the State of the or a modified tables when it's all over.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • How to compare two columns in Xl

    I want to compare two columns in the file of Xl. column A contains phrases and column B contains the words

    For example

    Column A                                                                       Column B                                                                           Column C

    I have an Apple and I'll eat every day Apple Apple

    I have a banana and eat weekly banana papaya

    Oranges are rich in nutritions cauliflowers Oranges

    Papaya is good for health                                               Grapes                                                                                 Papaya

    Oranges

    Lichi

    Banana

    I want to check each value of column B in each cell in column A, and if it matches then it should return the corresponding value in the result to me. Column C should Look Like as shown above.

    Can someone point me in the right direction here of what formula to use for this Xl.

    Thank you

    This is a forum for Mac OS X technologies, so here's an Applescript solution:

    1. Copy-paste the script in the Script Editor
    2. Select the cells in columns A and B
    3. Command + c to copy to the Clipboard
    4. Click on the button "run" in the Script Editor
    5. Click once in the top cell in column C where you want the data
    6. Command + v to paste

    Here are the results:

    There is no verification error here. You must select and copy to the Clipboard before the race.

    SG

    the value LstOfLsts to makeListOfLists (the Clipboard as a 'class utf8 ')

    the value theSentences to getCol1Vals (LstOfLsts)

    the value collected in getCol2Vals (LstOfLsts)

    game of theMatches to «»

    Repeat with I in collected items

    If theSentences contains I then ¬

    the value of theMatches to theMatches & i & return

    end Repeat

    Set the Clipboard for theMatches

    to getCol1Vals (LofL)

    game of col1Vals to «»

    Repeat with en LofL points

    the value col1Vals to the col1Vals & "" & i point 1

    end Repeat

    end getCol1Vals

    to getCol2Vals (LofL)

    the value col2Vals to {}

    Repeat with en LofL points

    If i's point 2 is not "" then ¬

    i copy point 2 to the end of col2Vals

    end Repeat

    return col2Vals

    end getCol2Vals

    at makeListOfLists (theTxt)

    value was to theTxt paragraphs

    the value text point of delimiters

    the value theListOfLists to {}

    Repeat with I from 1 to count was

    the value theListOfLists to the theListOfLists & {the was point i text elements}

    end Repeat

    the value point text delimiters to «»

    return theListOfLists

    end makeListOfLists

  • Input data match with two columns in a table

    Hello

    I want to find records where the input data (> 100 records) are adapted to the two columns of the table

    See below
    with t as
    (select 1 as id, 101 as num 'ram' that pat from dual
    Union
    Select 2 102, 'tom' from dual
    Union
    Select 1 103, 'tom1' from dual
    Union
    Select 2 101, 'tom2' from dual
    Union
    Select 2 104, 'tom3' from dual
    Union
    Select 1 105, 'tom1' from dual
    Union
    Select 2 105, 'tom1' from dual

    )
    Select * from t

    I want to find records from the 't' table where (id, num) will be (1 101, 2 102, 1, 105)

    Output must be

    ID num
    1 101
    2 102
    1 105
    select *
    from t
    where  (id, num) in (
              (1,101),
              (2,102),
              (1,105)
                 );
    

    Or store the input in a temporary table values and use IN

    select *
    from t
    where  (id, num) in (
              select col1,col2
                                    from your_temp_table
                 );
    

    Published by: JAC on 20 may 2013 14:55

  • Compare two rows in the same table

    Hi all

    I need to compare two rows in the same table, I don't know hoe to do it in pl/sql. Please help me on this.

    example:

    price of ro TR
    xya0001 AMA.7 12
    xya0003 ama6 14
    xya0004 AMA.7 16

    in table b is a unique value for each line, I need to compare the price column and see if the first value is less than or greater than the following value and, if there is more to put the corresponding value of br to a variable, and if it is less, put the corresponding value of the br to another variable. I don't know a method to do this, as I'm new to pl/sql. Please help me in this
    for data in(select tr,br,price, lag(price) over ( order by tr) newcol
    from yourtable)
    loop
    if nvl(data.newcol,0) > data.price then
    variable1:=data.br;
    else
    varable2:=data.br;
    end if;
    end loop;
    
  • [8i & 10g XE] How to compare a column with the text of a column with numbers

    This is probably a simple question, but I can't seem to find the answer. I tried variations on use to_number to_char and interpreters, all nothing will do.

    The real problem is that I have a table with a column of numbers in a database 8i (datatype = NUMBER (3)) and a column with the text (datatype = CHAR (3)), and I need to compare two values.

    This table has thousands of lines, but here's an example of the data in these two columns:
    TXT     CHR
    -----------
    001     1
    001     2
    002     2
    XXX     1
    003     3
    What I want to do is select the lines where the TXT and CHR VALUES do not match, then it would be (given my example):
    TXT     CHR
    -----------
    001     2
    XXX     1
    But, I'm having difficulties in comparing two columns, because they are not the same type of data.

    I tried to work on a simplified version of the problem in the 8i database both my 10g XE database:
    SELECT     *
    FROM     (
         SELECT     1.000               AS nbr
         ,     TO_CHAR(1.000,'000')     AS txt
         ,     CAST('001' AS CHAR(3))     AS chr
         FROM     dual
         )
    WHERE     txt = chr
    ;
    But this also returns any line, and it isn't even the "XXX" in the text column to treat in this example.

    Can someone help me understand what it is that I'm missing?

    Thank you!

    Hello

    user11033437 wrote:
    This is probably a simple question...

    Simple if you know the secret; maddening if you do not have.

    ... I tried to work on a simplified version of the problem in the 8i database both my 10g XE database:

    SELECT     *
    FROM     (
         SELECT     1.000               AS nbr
         ,     TO_CHAR(1.000,'000')     AS txt
         ,     CAST('001' AS CHAR(3))     AS chr
         FROM     dual
         )
    WHERE     txt = chr
    ;
    

    Try:

    TO_CHAR (1.000, 'FM000')
    

    By default, TO_CHAR leaves place the beginning of the string to a sign less, in which case he should ever one, TO_CHAR (1,000, '000') returns makes 4 characters, not 3. "FM" in the format said TO_CHAR do not add a space.

    If it does not, after the release of DUMP (txt) for the few lines that you can't match, so that we can see exactly what is in them.

  • Query took too much time when adding new column to the table and the index set on this

    I added a new column to the table that contains thousands of records. and created the composite index with three columns (those newly added + two existing column)

    for the specifics. TBL table there are two columns col1, col2

    I added the new column col3 to TBL and created composit index (col1, col2, col3).

    Now for all the records in col3 is NULL. When I choose on this table, it takes too long...

    Any idea what my I do bad., I have check the query plan, it is using the index

    It is solved using collection of statistics using the

    DBMS_STATS. GATHER_TABLE_STATS

    @Top.Gun thanks for your review...

  • Get columns from the table shown in the iterator

    Hello...

    I have the table in a collection of standard panel.  So, I can show/hide certain columns in the table using the columns in the view menu.

    Then I'm trying to do is export to excel (using apache poi) by looping through the table iterator.  What I can't do is search if the column is not displayed.  I don't want all the columns that are exported without worrying.  How can I achieve this?

    My bean is similar to the following for loop through the iterator:

    BindingContext bindingContext = BindingContext.getCurrent ();

    BindingContainer bindingContainer = bindingContext.getCurrentBindingsEntry ();

    DCIteratorBinding dcIteratorBinding = (DCIteratorBinding) bindingContainer.get ("EmployeesIterator");

    lines [] oracle.jbo.Row = dcIteratorBinding.getAllRowsInRange ();

    for (oracle.jbo.Row line: lines) {}

    {for (String colName: {row.getAttributeNames ())}

    output to excel cell here using row.getAttribute (colName) m:System.NET.SocketAddress.ToString)

    }

    }

    Thank you.

    Hello

    It's like ask the engine in your car to what colors the seats have. The iterator doesn't know anything about the visible state of a column. If the displayed columns must be determined from the table instance (richeTableau)

    The following article solves exactly the requirement that you have: Oracle ADF: Build Your Own it comes with a sample that you can download here: http://www.oracle.com/technetwork/issue-archive/2013/13-jul/o43adf-1940728.zip

    Have a look at CustomPanelCollectionBean.java:

    The method and code that you want to look for is:

    private String getRowHtml (row rw) {}

    StringBuffer rowHtmlBuf = new StringBuffer();

    Read visible columns in the table of the table instance. This way the

    PanelCollection can be used to show/hide columns and exclude

    printing to HTML

    Table richeTableau = this.getRichTable ();

    the list of columns determine the print attributes

    The list of columns in = table.getChildren ();

    int attrCount = columns.size ();

    rowHtmlBuf.append (this.addRowStart ());

    for (int i = 0; i)< attrcount;="" i++)="">

    for all visible columns, add columns to print

    If (((RichColumn) columns.get (i)) .isVisible ()) {}

    If (rw.getAttribute (i) instanceof ViewRowSetImpl) {}

    ignore the collections of detail used for master/detail example

    constraints in British Colombia ADF

    } ElseIf (rw.getAttribute (i) instanceof oracle.jbo.domain.Timestamp) {}

    shorten date to exclude the infromation times

    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");

    String dateFormatString = sdf.format (((Timestamp) rw.getAttribute (i)) .getData ());

    rowHtmlBuf.append (this.addDataCell (dateFormatString));

    } else {}

    Prnt attribute values and if sure that null values don't raise a NPE. Add a white character to NULL

    attribute values

    rowHtmlBuf.append (this.addDataCell (rw.getAttribute (i)! = null? rw.getAttribute (i) m:System.NET.SocketAddress.ToString ():))

    " "));

    }

    }

    }

    rowHtmlBuf.append (this.addRowEnd ());

    Return rowHtmlBuf.toString ();

    }

    You need to access the Rich Table instance (for example using the JSF component binding) to then compare the attribute in the iterator with the visibility of the column

    Frank

  • Oracle how to multiply two columns of different tables and results

    Oracle how to multiply two columns of different tables and get the result in the third column?

    I want to multiply all the lines of the quantinty column in the table of quantity with the relevant lines of the table of prices price column and get the result of multiplying in the third column. What should I use procedure trigerr? OR IS IT POSSIBLE HOW TO DO IT PLEASE HELP :D

    Edited by: 994229 2013-03-15 12:44
    /* Formatted on 3/15/2013 3:51:08 PM (QP5 v5.185.11230.41888) */
    CREATE TABLE mytable1
    AS
       (SELECT 1 id, 5 VALUE FROM DUAL
        UNION ALL
        SELECT 2, 7 FROM DUAL
        UNION ALL
        SELECT 3, 8 FROM DUAL);
    
    CREATE TABLE mytable2
    AS
       (SELECT 1 id, 4 VALUE FROM DUAL
        UNION ALL
        SELECT 2, 12 FROM DUAL
        UNION ALL
        SELECT 10, 12 FROM DUAL);
    
      SELECT id,
             mytable1.VALUE,
             mytable2.VALUE,
             mytable1.VALUE * mytable2.VALUE product
        FROM mytable1 FULL OUTER JOIN mytable2 USING (id)
    ORDER BY id;
    
    ID     VALUE     VALUE_1     PRODUCT
    1     5     4     20
    2     7     12     84
    3     8
    10          12     
    
  • display / hide column of the table running

    Are there known issues with display / hide a column of the table at run time?

    I have a table that contains a column with a check box and another with a radio button.  If the user is allowed to select more than one row in the table (as indicated by a form variable), then I want to hide the column of radio and checkbox column.  If not, I want to show / hide the contrary.

    I show / hide the column header too.  When I preview the form, however, the data in the table appears "scoot" left and placed in the column that is hidden, so to speak.

    Here is a view of the design of the table:

    tableDesignView.jpg

    And a view of the execution of the table.  You can see the radio is hidden, but the "account number" column wants to crush in the (hidden) radio column,

    tableRunTimeView.jpg

    Here is the script, I'm very confident in this small snippet of code because the lines of account were filling wonderfully until I added the column of radio buttons and the script to show/hide.

    Put the account data in the table

    function

    setAccountData (objAccountRow, objAccountItem) //Pass in the line and data to complete line

    {

    stuff the line

    objAccountRow.accountNumber.rawValue

    = objAccountItem.accountNumber;

    objAccountRow.accountName.rawValue

    = objAccountItem.accountName;

    objAccountRow.accountBalance.rawValue

    = objAccountItem.accountBalance;

    display the check box or radio button, depending on the number of accounts they are allowed to select (as specified by the form variable)

    var searchNumAccounts = objFragment.resolveNode("searchNumAccounts").value; Variable //Form

        if (searchNumAccounts==1)

    { //show the column of radio buttons and hide the checkbox column }

    hideObject (objResultsSubform.accounts.HeaderRow.txtSelect);   <-it's exaggerated here, to hide the table for each row header column,...

    hideObject (objAccountRow.accountSelected);

    showObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);

    showObject (objAccountRow.radioSubform.radioGroup.selected);

    }

    on the other

    { //show the checkbox column and hide the column of radio }

    hideObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);

    hideObject (objAccountRow.radioSubform.radioGroup.selected);

    showObject (objResultsSubform.accounts.HeaderRow.txtSelect);

    showObject (objAccountRow.accountSelected);

    }

    }

    OK I got it. The table object implements a container to contain the fields. You hid the ok fields, but you then never reset the row in the table to have only two columns. I copied the parameter of the XML source so that I would have the exact width and then deleted the one I wanted to hide. Now everything works fine.

    See the example updated the.

    Paul

  • Select all checkboxes in the column of the table during the 11 G radio button click

    Hello

    I have a table where I inserted a checkbox in the column of the table. I have two outside this table option button, Yes and no. When I select the option button Yes all the boxes in the table to spread and when I select any option button all the boxes should get deselected. As the boxes are inside the columns of the table, we can use setSelected(). How to do this please give ideas.



    Thank you.

    Hi, Maxim,.

    Is your table based on a view object or some bean code?
    If it is based on the view object, the column Boolean checkbox is bound to some transient attribute?

    Have you tried view iteration object rows (if your table bound to viewobject) /POJO(if created list of pojo instances in bean and bound to table) and by setting the Boolean attribute related to the box to true/false on valueChangeListener option button?

    Can you post an example of code to get an idea of your problem?

    Jean Lou

    Published by: Israel Jean Lou on October 24, 2009 04:50

  • How to use &lt; C:when test... inside the column in the table of the ADF

    I use ADF table with two columns
    in the first column, I check the Type of document is doc type so I have to use commondlink to download this file, otherwise I need to display only text.

    to this I added
    * < c:when test = "{boolean ($favoriteType eq 'doc')}" > *.
    that does not work.

    Please let me know how to use < C:when test... inside the column in the table of the ADF

    < tr:column sortProperty = "favoriteName" sortable = "true".
    headerText = "#{res ['favorite.favoritename ']}" "
    width = "500" noWrap = "false" >
    < c: choose >
    * < c:when test = "{boolean ($favoriteType eq 'doc')}" > *.
    < tr:commandLink actionListener = "#{bindings.downloadFile.execute} '"
    Text = "#{row.favoriteName} '"
    Disabled = "#{!}" Bindings.downloadFile.Enabled}"/ >
    < / c:when >
    < c: otherwise >
    < af:outputText value = "#{row.favoriteName}" / >
    < / c: otherwise >
    < / c: choose >
    < / tr:column >
    < tr:column sortProperty = "favoriteType" sortable = "true".
    headerText = "#{res ['favorite.favoriteType ']} ' rendering ="true">"
    < af:outputText value = "#{row.favoriteType}" id = "favoriteType" / > "
    < / tr:column >

    Hello

    I do not see, you use a Table of the ADF, but I see that you use Apache Trinidad. JSTL is executed analysis of time then that JSF is to render time, that's why it does not work what you see. Trinidad is a part of tr:switcher, and you can try this. Note that it doesn't ' r allow to change components by rank.

    Frank

  • Regd select the column in the table area

    Hello

    I have a search page... Have used autocustomization to create... This page will be used to query data from a table and then we must also update two fields of results table and save.

    There is a region of results. I've included the multiselect table option that made me select a column as the first column of the table. Also, including a tableaction and a button upate with whom...

    I need to write a handler for the update now... but do not understand all the slect column...

    Whenever a user clicks on the boxes to select specific records and change the fields and click Update to save, how to write code to check whether the checkbox option has been activated or not?


    Please help me as soon as possible...


    Kind regards
    Preeti

    Hello

    Take a Transient attribute tell 'SelectFlag' in view object and to set the Instance of the view and the view attribute
    for multipleselection in the table.

    Now that the update is click on the button:

    If (PageContext.GetParameter ("Update")! = null)
    {
    OAApplicationModule am = pageContext.getApplicationModule (webBean);
    OAViewObject vo = (OAViewObject) am.findViewObject ("projVO1");
    Line [] row = vo.getAllRowsInRange ();
    Loop through lines
    for (int i = 0; i)<>
    {
    Check if checbox is checked or not
    If (line.getAttribute("SelectFlag").toString().equals("Y"))//means checbox is checked for this line.
    {
    write your logic
    }
    }
    }

    Thank you
    Gerard

Maybe you are looking for

  • cannot open firefox; Profile showed lock-uninstalled and reinstalled, still cannot access

    Years, I used Firefox-suddlenly it won't open (can access the site with another browser). After spending hours reading forums, autonomies, etc. that I tried to look at the profile and he had a parental.lock shown in this topic. I am the administrator

  • myRio and first program FPGA

    Greetings, I'm looking for a very basic tutorial on the programming of the FPGA on the myRIO.Most of what I see wrong with retail targeted as your other ' getstarted ' tutorials using myRIO.  I want to create a digital logic (clocksignals) and/a. fun

  • request for help with drivers

    Dear support team, I ask you to help you find the drivers. Hardware for generic Bluetooth adapter ID: USB\VID_03F0 & PID_311D & REV_0001USB\VID_03F0 & PID_311D Hardware ID device Base system: PCI\VEN_197B & DEV_2392 & SUBSYS_167E103C & REV_30PCI\VEN_

  • Explorer Windows has stopped working error Code of Exception c0000005. I tried a lot of things please help!

    I am running Vista Home Premium.  I tried a system restore, restore the config, I tried chkdsk/f.  I tried almost everything in the knowledge base, with the exception of the running recovery discs - because I don't have a copy and repair start becaus

  • BlackBerry 10 Hw OS update

    My brother help me pls, hw can I update my OS 10 for the last dat of version is 10.3.1.1565 without WiFi network because if I was I there is no network WiFi here, pls I need to solution 4, pls.