Update a column on select  every row trigger?

I have a column in a table which is populated using random
number generator via an insert trigger. Is there a trigger call
I can make so that we may update this column ON FETCH/SELECT
with a new random number. Ideally will like to use a database
trigger to do this??? This is a wierd thing I need to do more
business related than anything else. Thanks.

No triggers on selects, but you don't need to.
Create a view with SELECT7DBMS_RANDOM.RANDOM FROM7DUAL.
See below, blanks replced with middle dots for alignment777
I wasn't sure it would work so I tried it ( and I always wanted
to name a column "quazi")!
7SQL>7CREATE7OR7REPLACE7VIEW7station_random
777277AS
777377SELECT7location_number7777
77747777777,7call
77757777777,7name_location
77767777777,7country_state
77777777777,7previous_name_flg
77787777777,7lat
77797777777,7lat_flg
77107777777,7lon
77117777777,7lon_flg
77127777777,7elev
77137777777,7quazi
7714777FROM7worldwide_station_list
7715777777,7(7SELECT7DBMS_RANDOM.RANDOM7AS7quazi
7716777777777777FROM7DUAL
771777777777)
7718777777;
View7created.
7SQL>7select7*7from7station_random7where7rownum7<76;7
LOCATI7CALL77NAME_LOCATION7777777CO7P7777777777777LAT7L7777777777
777LON7L777777777777ELEV77777777777QUAZI
------7-----7-------------------7--7-7---------------7-7---------
------7-7---------------7---------------
3258307'77777PETROPAVLOVSKKAMCAT7'77N7777777777752.597N7777777777
158.397E77777777777777247777771629503002
8900407'77777SANAE7AWS77777777777'77N7777777777771.427S7777777777
772.487W777777777777781777777-1215566745
8950407'77777TROLL777777777777777'77N77777777777777727S7777777777
772.327E7777777777771290777777-964057571
9965607DB6567ENVIRONM7BUOY7230517'77N7777777777723.427N7777777777
7758.37E7'7777777777777777777-1438450404
9966507DB6657ENVIRONM7BUOY7230527'77N7777777777722.367N7777777777
7759.37E7'777777777777777777777404164777
Elapsed:700:00:00.01
7SQL>7r
771*7select7*7from7station_random7where7rownum7<76
LOCATI7CALL77NAME_LOCATION7777777CO7P7777777777777LAT7L7777777777
777LON7L777777777777ELEV77777777777QUAZI
------7-----7-------------------7--7-7---------------7-7---------
------7-7---------------7---------------
3258307'77777PETROPAVLOVSKKAMCAT7'77N7777777777752.597N7777777777
158.397E777777777777772477777-1470640679
8900407'77777SANAE7AWS77777777777'77N7777777777771.427S7777777777
772.487W77777777777778177777777-17578400
8950407'77777TROLL777777777777777'77N77777777777777727S7777777777
772.327E77777777777712907777777-26724017
9965607DB6567ENVIRONM7BUOY7230517'77N7777777777723.427N7777777777
7758.37E7'7777777777777777777-1870972567
9966507DB6657ENVIRONM7BUOY7230527'77N7777777777722.367N7777777777
7759.37E7'777777777777777777771035733761
Elapsed:700:00:00.01
Good Luck...

Similar Messages

  • ADF 11g Partial Triggers Row Column Update By Column in the Same Row

    Hi.
    I have a situation whereby I have a checkbox in a table row, which has an eventchangelistener, which upon activation, trys to update another column in the same row. I can not get this to work through partial triggers, even though I have set up my ids up correctly. The row though can be updated by a command button outside of the table using the same coding techniques, but I need it updated via the checkbox.
    Is there a limitation in updating a column within a row, from another row column's event change listener.
    Thanks.

    Updating the other rows from the checkbox works fine for me. Here is what I did.
    I DnD Emp table with a new column that says if the emp is new hire. If the checkbox is checked, I set Firstname and Lastname for that row as NewHire. I have partial triggers on Firstname and Lastname columns to update whenever checkbox is checked/unchecked and autosubmit on checkbox to true. Hope this helps.
    Try adding column selection property to single and see if it helps.
    Edited by: asatyana on Jan 16, 2012 12:48 AM
    Edited by: asatyana on Jan 16, 2012 12:49 AM

  • Changing column value on every row in invoice matrix

    Hi,
    I'm trying to change the value of the GLaccount column for every row in the invoice matrix when the user changes the document owner.  The code seems to work for the first row  but then on other rows I get a message that says the item can't be changed because it can't get focus.  I know there are similar posts on the forum already, but nothing that solves this problem that I can see.
    My code follows:
            <B1Listener(BoEventTypes.et_CHOOSE_FROM_LIST, False)> _
            Public Overridable Sub OnAfterChooseFromList(ByVal pVal As ItemEvent)
                Dim ActionSuccess As Boolean = pVal.ActionSuccess
                Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)
                Dim item As Item = form.Items.Item("222") 'document owner
                Dim item2 As Item = form.Items.Item("38")
                Dim Matrix As Matrix = CType(item2.Specific, Matrix)
                Dim userID As String
                userID = ChooseFromList_Value(pVal)
                If ActionSuccess And pVal.InnerEvent Then
                    ChangeMatrixAccounts(Matrix, userID)
                End If
            End Sub
        Friend Function ChangeMatrixAccounts(ByVal zMatrix As SAPbouiCOM.Matrix, ByVal zDocOwner As String) As ReturnStatus
                For x = 1 To zMatrix.RowCount
                    Dim cell As SAPbouiCOM.Cell = zMatrix.Columns.Item("159").Cells.Item(x)
                    Dim oedit As SAPbouiCOM.EditText = zMatrix.Columns.Item("159").Cells.Item(x).Specific
                    cell.Click(SAPbouiCOM.BoCellClickType.ct_Regular) 'force focus, I hope
                    ChangeRevenueAccountInCell(oedit, WhseGLLocCode)
                Next
    end function
        Private Function ChangeRevenueAccountInCell(ByVal zGLAcct As SAPbouiCOM.EditText, ByVal zWhseGLLocCode As String) As ReturnStatus
            Dim tempwork(2) As String
            'change the value of the matrix cell passed in to the new gl acct
            tempwork = zGLAcct.Value.Split("-")
            <b>zGLAcct.Value = tempwork(0) & "-" & tempwork(1) & "-" & zWhseGLLocCode</b>
            Console.Write(" Changed GL value")
        End Function
    Is there more to it than that?  -- THANKS!

    Hi John,
    I don't know if this is of use, but here's the code I used to set the project code value on each row of a marketing document through the UI (which is similar to what you are looking to do). The Project Code column needs to be visible and editable for this to work:
    Private Function SetProjectCodeOnRows(ByVal oForm As SAPbouiCOM.Form, ByVal oMatrix As SAPbouiCOM.Matrix, ByVal sProjectCode As String) As Boolean
            Dim bSuccess As Boolean = True
            Dim sItemCode As String
            Dim sExistingProjCode
            Dim i As Int32
            Dim oCol As SAPbouiCOM.Column
            Dim oEdit As SAPbouiCOM.EditText
            Dim oFolder As SAPbouiCOM.Folder
            'Select the Contents folder before updating any project codes
            oFolder = oForm.Items.Item("112").Specific
            oFolder.Select()
            For i = 1 To oMatrix.RowCount
                Try
                    ' Check to see if an item code has been entered (last line will always be empty)
                    oCol = oMatrix.Columns.Item("1")
                    oEdit = oCol.Cells.Item(i).Specific
                    sItemCode = oEdit.String
                    ' Read the project code from the row
                    oCol = oMatrix.Columns.Item("31")
                    oEdit = oCol.Cells.Item(i).Specific
                    sExistingProjCode = oEdit.String
                    If sExistingProjCode = "" And sItemCode <> "" Then
                        oEdit.Value = sProjectCode
                    End If
                Catch ex As Exception
                    m_sboApp.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, True)
                    bSuccess = False
                End Try
            Next i
            SetProjectCodeOnRows = bSuccess
        End Function
    Kind Regards,
    Owen

  • ADF Mobile updating a column for all the rows

    Hi Every one,
    This is My ADFMobile Usecase:
    In My use case, I created DB Webservices  and created a  datContol on it .
    I have few AMX pages in my Taskflow.
    1st page: Authentication page with userid and p/w.
    2nd page:Need to get DeptID as  LOV and a submit button.
    3rd Page:Need to get all Employees in that Department. Need to get Empl_name, Empl_Id, Empl_salary and Empl_ Attendence. and a SYNC Button.
    Up to now every thing is fine.
    But I need to change  Empl_Attendence Column As absent or Present . I used  SelectOneChoice. Default there will be PRESENT value in back end.So after Selecting  SlectOneChoice the value (Absent) should Automatically update in DB for that row.
    Requirement:
    So How to write logic for the SYNC button to update the Empl_ Attendence for all the rows at a time.
    Thanks In Advance
    Regards
    Varma.

    Hi Every one,
    This is My ADFMobile Usecase:
    In My use case, I created DB Webservices  and created a  datContol on it .
    I have few AMX pages in my Taskflow.
    1st page: Authentication page with userid and p/w.
    2nd page:Need to get DeptID as  LOV and a submit button.
    3rd Page:Need to get all Employees in that Department. Need to get Empl_name, Empl_Id, Empl_salary and Empl_ Attendence. and a SYNC Button.
    Up to now every thing is fine.
    But I need to change  Empl_Attendence Column As absent or Present . I used  SelectOneChoice. Default there will be PRESENT value in back end.So after Selecting  SlectOneChoice the value (Absent) should Automatically update in DB for that row.
    Requirement:
    So How to write logic for the SYNC button to update the Empl_ Attendence for all the rows at a time.
    Thanks In Advance
    Regards
    Varma.

  • How to Update some column values in some rows in an advanced table

    Hi Gurus,
    Can any body help on this issue.
    I am having a results table which is showing all the queried parties data queried in a seeded page in OCO module.
    Lets assume the table contains 10 rows with the below columns
    Party Name, Registry ID, Address Country, Match Percentage, Certification Level, Certification Reason, Internal Indicator, Status .
    Certification Level, Certification Reason and Internal Indicator are the dropdowns.
    The user want to update some of these fields values for some rows randomly.
    After doing this if he click on Save button, Only thosed changed rows need to get update using a Custom Procedure.
    But here all the rows irrespective of the change getting updated.
    So  how to capture the modified rows.
    Appreciate any inputs..
    Thanks
    Palepu
    Edited by: Palepu on 9 Aug, 2012 4:25 PM

    Not sure if you got the answer. You need to capture the row which got changed using the below and get the column value using the getAttribute method. This works for single selection row, if it is multi selection then you will have to loop through all selected rows and find the VO attribute value.
    String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    Row currentRow = am.findRowByRef(rowReference);
    String param1= (String)currentRow.getAttribute("VOAttribute");
    Let me know if there are any issues.
    Thanks
    Shree

  • Displaying new column while selecting the rows

    Hi,
    I am a new member of this forum and also beginner to database. Please let me know ,how to write a query for the below question.
    There is a table with following details.
    Name     Total marks
    AAA     300
    BBB     200
    CCC     500
    DDD     150
    EEE     600
    I want this detail to be arranged in descending order of total marks.And a new column should show the order of the result set, ranked from highest to lowest, in the order of Total marks.
    i.e.,
    Output should looklike as follows,
    Name     Total marks Rank
    EEE     600     1
    CCC     500     2
    AAA     300     3
    BBB     200     4
    DDD     150     5
    Query:
    Select name,total marks from studenttable orderby 2.
    I want to know ,what to include with this query to get the rank column.

    Krystian, the order by along with rownum at the same level will not always work.
    SQL> select rownum, name from studenttable ;
        ROWNUM NAME
             1 AAA
             2 BBB
             3 CCC
             4 DDD
             5 EEE
    5 rows selected.
    SQL> select rownum, name from studenttable order by marks ;
        ROWNUM NAME
             4 DDD
             2 BBB
             1 AAA
             3 CCC
             5 EEE
    5 rows selected.
    SQL>Just do a select on the ordered resultset:
    SQL> select t.*, rownum rank from (select name, marks from studenttable order by 2) t ;
    NAME            MARKS       RANK
    DDD               150          1
    BBB               200          2
    AAA               300          3
    CCC               500          4
    EEE               600          5
    5 rows selected.
    SQL>

  • How to select every row in a table in case there is no user input ?

    My control block is : DUMMY_BLK . It has field : RPTNO.
    My base Block is : T_UNLDLD_BLK .
    In the property palette, the where clause is : ULD_RPTNO = :DUMMY_BLK.RPTNO
    When the user presses the search button , he gets results according to the report no keyed in . My when-button-pressed trigger contains the following code:
    go_block('T_UNLDLD_BLK');
    execute_query;
    If the RPTNO is null , I should get displayed all records from T_UNLDLD table .
    How can I do that , what do I need to add to the where clause please?
    Thanks.

    I think using same trick will work in this case also.
    Modify your where clause as:
    ULD_SHP_AGCODE LIKE NVL(:DUMMY_BLK.SA_NAME,'%') AND TRUNC(ULD_ETA) BETWEEN nvl(:DUMMY_BLK.ETA,'15-aug-1947') AND nvl(:DUMMY_BLK.ETA_TO,'15-aug-2050').
    Please note, i've taken from date as a value in the past and to date as value in future if they are NULL.
    I am sure, your ULD_ETA will fall between those two default dates.
    Hope it helps.
    Please mark answer as helpful / correct, if it helps you
    Navnit
    Edited by: Navnit Punj on 29-Jun-2009 04:10

  • How to programatically select a row in TableBean and update its column?

    Hi,
    Can anyone help me on How to programmatically select a row in a TableBean and update its column?
    Thanks,
    Jon

    Hi,
    My requirement is I need to update a column in a particular row of the table using fire action...
    I have a datefield bean serve as birhdate and base on this I need to update the age column depending on the given dates..
    Here's my code under the Process form request for your reference...
    if (actionInMainPersonScreen.equals("changeDate"))
    String checkId = pageContext.getParameter("paramDatePersonId");
    OAFormValueBean depPerId = (OAFormValueBean)depTable.findIndexedChildRecursive("ChildPersonID");
    OAMessageTextInputBean depFName = (OAMessageTextInputBean)depTable.findIndexedChildRecursive("FirstName");
    OAMessageDateFieldBean dateBirth = (OAMessageDateFieldBean)depTable.findIndexedChildRecursive("BDay");
    OAMessageStyledTextBean age = (OAMessageStyledTextBean)depTable.findIndexedChildRecursive("Age");
    Date changeBDate = new java.util.Date();
    Date dateToday = new java.util.Date();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    changeBDate = (Date)dateBirth.getValue(pageContext);
    Calendar cal = Calendar.getInstance();
    ResultSet empAge = null;
    String newAge = null;
    OADBTransaction trans = personam.getOADBTransaction();
    System.out.println("BirthDate: " + changeBDate + " Date Today: " + sdf.format(dateToday));
    String expQuery = "SELECT Trunc((sysdate - To_Date('" + pageContext.getParameter("paramDateBirth") + "'))/365) compAge, Sysdate from dual";
    System.out.println("SQL: " + expQuery);
    PreparedStatement expPreparedStatement = trans.createPreparedStatement(expQuery ,1);
    try
    empAge = expPreparedStatement.executeQuery();
    } catch (SQLException e) {}
    try
    while (empAge.next())
    newAge = empAge.getString("compAge");
    age.setText(pageContext, newAge);
    empAge.close();
    } catch (SQLException e) {}
    regards,
    Jon

  • Updating one row updates every row in the table

    I'm having a weird problem in which I insert a row into a table, select that row, and update its columns, and all the rows in the table end up with those columns all set to the new value. Like this:
    A B C
    1 4 7
    2 3 8
    9 6 7
    Statement s1 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    s1.execute("INSERT INTO table (A) VALUES (5)");
    Statement s2 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    RecordSet rs = s2.executeQuery("SELECT * FROM table WHERE A=5");
    if (rs.next()) {
      rs.updateInt("B", 4);
      rs.updateInt("C", 6);
      rs.updateRow();
    A B C
    1 4 6
    2 4 6
    9 4 6
    5 4 6I'm using Mac OS X 10.4.9, OpenBase Solo 10.0.5, and Java 1.5. I hope someone has experienced this before because it has me befuddled.
    Here is the actual code from my program:
    Statement st;
    ResultSet rs;
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs = st.executeQuery("SELECT * FROM characters WHERE UniqueID=\""+uid+"\"");
    if (rs.next()) {
         JOptionPane.showMessageDialog(this, "The Unique ID \""+uid+"\" is already taken by "+com.kreative.mccm.Character.flName(rs)+".", "", JOptionPane.ERROR_MESSAGE);
         return false;
    rs = st.executeQuery("SELECT * FROM characters WHERE CodePoint="+cp);
    if (rs.next()) {
         JOptionPane.showMessageDialog(this, "The code point "+h(cp,4)+" is already taken by "+com.kreative.mccm.Character.flName(rs)+".", "", JOptionPane.ERROR_MESSAGE);
         return false;
    st.close();
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    st.execute("INSERT INTO characters (UniqueID, CodePoint) VALUES (\""+uid+"\", "+cp+")");
    st.close();
    this.uid = uid;
    this.cp = cp;
    this.ch.setUniqueIDString(uid);
    this.ch.codePoint = cp;
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs = st.executeQuery("SELECT * FROM characters WHERE UniqueID=\""+ch.getUniqueIDString()+"\"");
    if (rs.next()) {
         ch.writeResultSet(rs, false, false); /* (this does the updates) */
         rs.updateRow();
         charSaveChanges.setEnabled(false);
    } else {
         throw new SQLException();
    rs.close();
    st.close();

    OpenBase powers Apple's online store, so I wouldn't think that's the problem. I'm placing all the blame on the JDBC driver.
    Funnily, I started updating ResultSets that way because executing UPDATE statements directly gave me this problem before. Doing it this way made the problem go away, until now.
    I tried replacing the INSERT with two fields with one with all the fields, and now it throws a SQL error that is most definitely bogus:
    java.sql.SQLException: SQL ERROR - [position 569, near '' in ', 0, 0, 0, ''] insert error: comma expected but not found in data.
    SQL: INSERT INTO characters (UniqueID, CodePoint, NameFirst, NameMiddle, NameLast, NameMaiden, NameCommFirst,
    NameCommMiddle, NameCommLast, NameCommFull, Title, Classification, Subclassification, Considerable, SexString,
    TransitionString, GenderString, OrientationString, TitleString, PronounString, SGO, BirthDay, BirthMonth, BirthYear,
    Generation, FirstOfSet, ParentBio, Parent1, Parent2, Parent3, ParentBioType, Parent1Type, Parent2Type, Parent3Type)
    VALUES ('bomb', 123, 'Ziggy', 'Boogy', 'Doog', '', '', '', '', '', '', -1, -1, 1, '', '', '', '', '', '', 0, 0, 0, 0, 0, '', '', '', '', '', 0, 0, 0, 0)Bogus because there are the same number of data items as field names, and position 569 is a comma.
    At this point I have to ask myself why I ever chose OpenBase in the first place. (That's right, I had a RealBasic plugin for it. shudders) I'm sure OpenBase itself is fine, but its JDBC driver is trash. MySQL here I come.
    (Message was edited to prevent looooong horizontal scrolling)

  • Results not updating for every row in BIpublisher

    Hi all I have a Bi publisher report that is updating the results for the first row and in the second row to update the results it is picking the values from the first column itself and using the same values for all the other rows.
    Here is my report format
    Month saves Total, for 30,60,90,120
    Jan
    feb
    Mar
    Total are the enrolls by each month and days shows after 30,60,90,120 how many are still active. Following eg should give an idea of exactly whats happening
    Eg:
    Total 30days 60days 90days 120days 150days 180days 210days
    ------------------------------------------------------------------------------------------------------------------------------------------------------------ Jan saves 330 287 274 270 263 262 259 257
    Feb saves 298 255 242 238 231 230 227 225
    Mar saves 291 248 235 231 224 223 220 218
    So what is happening is lets say for example there are a total of 330 enrolls in january and after 30days 287 are still active and after 60days 274 are still active after 90 270...... etc
    Am getting the January active values correctly.
    BUt going forward when I see the values for february The total enrolls for february is 298 and after 30 days which are active is not giving me the correct.
    It is substracting the same amount as jan. looking at the numbers it is substracting
    -43, -13,-4,-7,-1,-3,-2 for Jan which are the cancels after the consecutive days
    It is substracting the same amount for feb also but my actual cancels for feb are different it should be 45,12,8,9,2,2,
    It is doing the same for all the months.
    There should be a change in the code. Following is the XSL code am using in
    <?xdoxslt:set_variable($_XDOCTX, 'v_SavesCanceled', SAVES_CANCELED_COUNT)?>
    <?xdoxslt:set_variable($_XDOCTX, 'v_RtSaves', xdoxslt:get_variable($_XDOCTX, 'v_RtSaves') - xdoxslt:get_variable($_XDOCTX, 'v_SavesCanceled'))?>
    <?xdoxslt:get_variable($_XDOCTX, 'v_RtSaves')?>
    Actually the cancels should be updated for each row but its picking the same cancels for every month.
    Hope it is clear let me know if you need any further info
    Any help is appreciated.
    Thanks

    Thank you very much for your help. The rtf file sent worked and updating results as required.Thank you
    Thanks

  • Update Button for every Row of Report

    hello,
    is it possible to get an update button for every row of a report?
    After clicking this button, only this row of the report should be updated.
    thanks in advance
    dave

    Create a hidden item on your page. Call it somehow - P1_KEY. Create other hidden fields
    for the rest of the columns you want to update. Create a link per report line. This link will be
    inserting the primary key of your record into P1_KEY and the other values you want to
    update in the other hidden fields. It will branch to the same page and contain a request - i.e. UPDATE_ROW. Then
    you create a process - On Load Before Header - which will
    take the value from your item P1_KEY and update the record
    in the database by setting the the column values to the
    values in your hidden fields. This process will fire upon
    request you specified. However, this way you will not be
    able to update your text areas, since you will not be able
    to transfer this over a link. Also you need to be carefull
    about special characters.
    Maybe there is a better proposal than this.
    Denes Kubicek

  • Selecting Single Rows that match to a column within group function output

    Trying to write a Query that will look through a data set that will return the Barcodes of CompoundNames that have a summed Quantity > 500.
    So if it was ran against the sample table below the output would be
    0005
    0006
    0007
    0008
    0009
    0010
    Barcode, CompoundName, BatchId, Quantity
    0001, XE 1000, XE 1000 100, 100
    0002, XE 1000, XE 1000 101, 100
    0003, XE 1000, XE 1000 102, 100
    0004, XE 1000, XE 1000 103, 100
    0005, XE 2000, XE 2000 100, 100
    0006, XE 2000, XE 2000 101, 100
    0007, XE 2000, XE 2000 102, 100
    0008, XE 2000, XE 2000 103, 100
    0009, XE 2000, XE 2000 104, 100
    0010, XE 2000, XE 2000 105, 100
    0011, XE 3000, XE 3000 100, 100
    I've got this far
    Select CompoundName, SUM(QUANTITY) FROM Table
    GROUP BY CompoundName
    HAVING SUM(QUANTITY) > 500)
    order by compoundname;
    But I need each Barcode that corresponds to each batchid when the summed quantity of the batches is > 500.
    TIA

    Replacing a GROUP BY Aggregate function by analytic equivalent (using PARTITION BY)
    will return every ROW (limited by where clause) but will not perform
    actual "aggregation operation.
    So it is possible that *selected result set* could contain duplicate row. Of course it depends on columns being seected and input data.
    +Ofcourse OPs sample data returns the same result with or without DISTINCT+
    For example...
    *WITH DISTINCT*
    {code}
    sudhakar@ORCL>with t1 as
    2 (select 0001 barcode,'XE0000' COMPOUNDNAME, 700 quantity FROM DUAL UNION ALL
    3 select 0003 ,'XE1000' , 20 FROM DUAL UNION ALL
    4 select 0003 ,'XE1000' , 280 FROM DUAL UNION ALL
    5 select 0003 ,'XE2000' , 50 FROM DUAL UNION ALL
    6 select 0003 ,'XE2000' , 100 FROM DUAL UNION ALL
    7 select 0003 ,'XE2000' , 150 FROM DUAL UNION ALL
    8 select 0003 ,'XE2000' , 200 FROM DUAL UNION ALL
    9 select 0003 ,'XE2000' , 750 FROM DUAL UNION ALL
    10 select 0003 ,'XE2000' , 120 FROM DUAL UNION ALL
    11 select 0003 ,'XE1000' , 70 FROM DUAL
    12 )
    13 select distinct * from
    14 (
    15 Select Barcode, CompoundName, SUM(QUANTITY) over (partition by CompoundName) sumqty
    16 FROM t1
    17 )
    18 where sumqty > 500
    19 order by compoundname;
    BARCODE COMPOU SUMQTY
    1 XE0000 700
    3 XE2000 1370
    sudhakar@ORCL>
    {code}
    *WITHOUT DISTINCT*
    {code}
    sudhakar@ORCL>with t1 as
    2 (select 0001 barcode,'XE0000' COMPOUNDNAME, 700 quantity FROM DUAL UNION ALL
    3 select 0003 ,'XE1000' , 20 FROM DUAL UNION ALL
    4 select 0003 ,'XE1000' , 280 FROM DUAL UNION ALL
    5 select 0003 ,'XE2000' , 50 FROM DUAL UNION ALL
    6 select 0003 ,'XE2000' , 100 FROM DUAL UNION ALL
    7 select 0003 ,'XE2000' , 150 FROM DUAL UNION ALL
    8 select 0003 ,'XE2000' , 200 FROM DUAL UNION ALL
    9 select 0003 ,'XE2000' , 750 FROM DUAL UNION ALL
    10 select 0003 ,'XE2000' , 120 FROM DUAL UNION ALL
    11 select 0003 ,'XE1000' , 70 FROM DUAL
    12 )
    13 select * from
    14 (
    15 Select Barcode, CompoundName, SUM(QUANTITY) over (partition by CompoundName) sumqty
    16 FROM t1
    17 )
    18 where sumqty > 500
    19 order by compoundname;
    BARCODE COMPOU SUMQTY
    1 XE0000 700
    3 XE2000 1370
    3 XE2000 1370
    3 XE2000 1370
    3 XE2000 1370
    3 XE2000 1370
    3 XE2000 1370
    7 rows selected.
    sudhakar@ORCL>
    {code}
    vr,
    Sudhakar B.

  • How to auto update date column without using trigger

    Hi,
    How to write below MYSQL query in Oracle 10g :
    CREATE TABLE example_timestamp (
    Id number(10) NOT NULL PRIMARY KEY,
    Data VARCHAR(100),
         Date_time TIMESTAMP DEFAULT current_timestamp on update current_timestamp
    I need to auto update the Date_Time column without using trigger when ever i update a record.
    Example shown below is from MYSQL. I want to perform the below steps in ORACLE to auto update Date_Time column.
    mysql> INSERT INTO example_timestamp (data)
    VALUES ('The time of creation is:');
    mysql> SELECT * FROM example_timestamp;
    | id | data | Date_Time |
    | 1 | The time of creation is: | 2012-06-28 12:37:22 |
    mysql> UPDATE example_timestamp
    SET data='The current timestamp is: '
    WHERE id=1;
    mysql> SELECT * FROM example_timestamp;
    | id | data | Date_Time |
    | 1 | The current timestamp is: | 2012-06-28 12:38:55 |
    Regards,
    Yogesh.

    Is there no functionality in oracle to auto update date column without using trigger??
    I dont want to update the date column in UPDATE statement.
    The date column should automatically get updated when ever i execute an Update statement.

  • On ALV report in1 column I want to put Icon on every row of that column.

    On ALV report there is 1 column I want to put Icon on every row of that column.That ALV program uses object oriented concept all class and methods.
      I want to use that icon on that row. That icon name is ‘ICON_OKAY’
    In my program when I assign values to internal table at that time I am assigning that ‘ICON_OKAY’ value to that row as follow.
    Itab-
    Itab-icon = ICON_OKAY.
    Append itab.

    please follow below procedure to display icon in ALV
    1) In corresponding fieldcatelog entry do
    fieldcatalog-icon = 'X'
    2) While filling the internal table fill the corresponding key value of icon , for example ICON_OKAY value is '@0V@' so statement would be
    Itab-icon = '@0V@'
    to get list of corresponding key for icon open include <ICON> in se38

  • How can i select the next column instead of next row when press enter key

    I need to know how can i select the next column instead of next row when i press the enter key.By default ,when i press enter key the next row is selected and the column remain unchanged but I wants opposite that is the row should remain unchanged but column index will changed.
    Thanks to all.

    Well, the right arrow key will already move you to the next column, so the easiest way to do this is to modify the InputMap to have the Enter key invoke the same Action as the right arrow key.
    You can search the forum for my "Table Actions" (without the space) example that will show you how to do this.

Maybe you are looking for