Checking NULL in multi column Update

I have a Update query that updates 2 columns based on the value from other table. Now there may not be a corresponding record in 2nd table and so my first table can be updated with NULL. Now how do i perform a NVL check for this
Query
Update Table1
Set (col2,col3) =
( select col2, col3
from table2
where table2.col1 = table1.col1)
At present i have to repeat the entire condition in SET clause into where clause to avoid this. Is there any better way ?

Eric:
The restriction is that each row in table1 must match with only one row in table2 (or none in which case it will be eliminated from the join and, therefore, not updated). Many rows in table1 can match with a single row in table2.
SQL> CREATE TABLE t (id NUMBER, descr VARCHAR2(10));
Table created.
SQL> INSERT INTO t VALUES (1, 'One');
1 row created.
SQL> INSERT INTO t VALUES (1, 'Un');
1 row created.
SQL> INSERT INTO t VALUES (2, 'Two');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> CREATE TABLE t1 (id NUMBER, descr VARCHAR2(10));
Table created.
SQL> ALTER TABLE t1 ADD CONSTRAINT t1_pk PRIMARY KEY (id);
Table altered.
SQL> INSERT INTO t1 VALUES(1, 'Uno');
1 row created.
SQL> INSERT INTO t1 VALUES (3, 'Tres');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> UPDATE (SELECT t.id, t.descr, t1.descr t1descr
  2          FROM t, t1
  3          WHERE t.id = t1.id)
  4  SET descr = t1descr;
2 rows updated.
SQL> SELECT * FROM t;
        ID DESCR
         1 Uno
         1 Uno
         2 TwoThe uniqueness of table2 must be declared, it is not determined at runtime,
SQL> ROLLBACK;
Rollback complete.
SQL> ALTER TABLE t1 DROP CONSTRAINT t1_pk;
Table altered.
SQL> UPDATE (SELECT t.id, t.descr, t1.descr t1descr
  2          FROM t, t1
  3          WHERE t.id = t1.id)
  4  SET descr = t1descr;
SET descr = t1descr
ERROR at line 4:
ORA-01779: cannot modify a column which maps to a non key-preserved tableJohn

Similar Messages

  • Oracle Lite Multi Column Updates

    I am new to Oracle Lite. I had heard that there is some problem with Oraclelite w.r.t. handling multi column update. Something like this MAY or MAY NOT work:
    Update Emp
    set ename = 'ABC',
    job = 10,
    desc = (select 'desc' from dual)
    where empno = 10;
    Is that true? Any feedback...
    Thanks,
    SD

    I am new to Oracle Lite. I had heard that there is some problem with Oraclelite w.r.t. handling multi column update. Something like this MAY or MAY NOT work:
    Update Emp
    set ename = 'ABC',
    job = 10,
    desc = (select 'desc' from dual)
    where empno = 10;
    Is that true? Any feedback...
    Thanks,
    SD I have not seen or heard of any multi-column update issues as of 5.0.1

  • Conditional Select List in a Report maintained using a Multi Row Update

    I have a SQL Report that is maintained with a "Multi Row Update" process. One of the columns needs to be ether a "Select List" based on a named LOV or just "Text" (Read Only) based on the value in the column. I have the UI working using a case statement and apex_items in me SQL but the Report Column is not marked "Edit" and the "Multi Row Update" process just ignores changes.
    Any help would be great!

    Just curious, why is the first parameter to in third TEXT_FROM_ITEM invocation NULL instead of 20? Also check your first parameter in your ELSE. Shouldn't it be a global number as well?
    Did you try adding a hidden item to your SELECT statement? Something like:
    (case
    when CSSN.KTTR_BILL_STAT_UID = KT_UTIL_PKG.get_kttr_uid_from_ref_val('SESSION_BILL_STAT','SESSION_BILL_STAT_1') then
    apex_item.select_list_from_lov(20,CSSN.KTTR_BILL_STAT_UID,'KTTR_SESSION_BILL_STAT_PRPR','','NO')
    when CSSN.KTTR_BILL_STAT_UID = KT_UTIL_PKG.get_kttr_uid_from_ref_val('SESSION_BILL_STAT','SESSION_BILL_STAT_2') then
    apex_item.select_list_from_lov(20,CSSN.KTTR_BILL_STAT_UID,'KTTR_SESSION_BILL_STAT_PRPR','','NO')
    when CSSN.KTTR_BILL_STAT_UID is null then
    apex_item.text_from_lov(20,'KTTR_SESSION_BILL_STAT')
    else
    apex_item.text_from_lov(20,CSSN.KTTR_BILL_STAT_UID,'KTTR_SESSION_BILL_STAT')
    end) as KTTR_BILL_STAT_DISP,
    apex_item.hidden(30,CSSN.KTTR_BILL_STAT_UID) MIRRORThen in either an Javascript onBlur event on KTTR_BILL_STAT_DISP or in a Page Process assign the value of KTTR_BILL_STAT_DISP to MIRROR.
    Mike

  • Multi-column BITMAP index vs. multiple BITMAP indices?

    Given the table (simple, made-up example):
    CREATE TABLE applicant_diversity_info (
    applicant_diversity_id NUMBER(12), PRIMARY KEY(applicant_diversity_id),
    apply_date DATE,
    ssn_salted_md5 RAW(16),
    gender CHAR(1), CHECK ( (gender IS NULL OR gender IN ('M','F')) ),
    racial_continent VARCHAR2(30), CHECK ( (racial_continent IS NULL
    OR racial_continent IN ('Europe','Africa','America','Asia_Pacific')) ),
    ethnic_supergroup VARCHAR2(30), CHECK ( (ethnic_supergroup IS NULL OR ethnic_supergroup IN ('Latin American','Other')) ),
    hire_salary NUMBER(11,2),
    hire_month DATE,
    termination_salary NUMBER(11,2),
    termination_month DATE,
    termination_cause VARCHAR2(30), CHECK ( (termination_cause IS NULL
    OR termination_cause IN ('Resigned','Leave of Absence','Laid Off','Performance','Cause')) )
    Oracle (syntactically) allows me to create either one BITMAP index over all four small-cardinality columns
    CREATE BITMAP INDEX applicant_diversity_diversity_idx ON applicant_diversity_info (
    gender, racial_continent, ethnic_supergroup, termination_reason );
    or four independent indexes
    CREATE BITMAP INDEX applicant_diversity_gender_idx ON applicant_diversity_info ( gender );
    CREATE BITMAP INDEX applicant_diversity_race_idx ON applicant_diversity_info ( raceial_continent );
    etc.
    What is the difference between the two approaches; is there any meaningful difference in disk-space between the one multi-colum index and the four single-column indexes? Does it make a difference in what the query-planner will consider?
    And, if I define one multi-column BITMAP index, does the order of columns matter?

    >
    What is the difference between the two approaches; is there any meaningful difference in disk-space between the one multi-colum index and the four single-column indexes? Does it make a difference in what the query-planner will consider?
    And, if I define one multi-column BITMAP index, does the order of columns matter?
    >
    You may want to read this two-part blog, that answers that exact question, by recognized expert Richard Foote
    http://richardfoote.wordpress.com/2010/05/06/concatenated-bitmap-indexes-part-i-two-of-us/
    http://richardfoote.wordpress.com/2010/05/12/concatenated-bitmap-indexes-part-ii-everybodys-got-to-learn-sometime/
    As with many things Oracle the answer is 'it depends'.
    In short the same considerations apply for a concatenated index whether it is bitmap or b-tree: 1) will the leading column usually be in the predicate and 2) will most or all of the index columns be specified in the queries.
    Here are some quotes from part 1
    >
    Many of the same issues and factors in deciding to create a single, multi-column index vs. several, single column indexes apply to Bitmap indexes as they do with B-Tree indexes, although there are a number of key differences to consider as well.
    Another thing to note regarding a concatenated Bitmap index is that the potential number of index entries is a product of distinct combinations of data of the indexed columns.
    A concatenated Bitmap index can potentially use less or more space than corresponding single column indexes, it depends on the number of index entries that are derived and the distribution of the data with the table.
    >
    Here is the lead quote from part 2
    >
    The issues regarding whether to go for single column indexes vs. concatenated indexes are similar for Bitmap indexes as they are for B-Tree indexes.
    It’s generally more efficient to access a concatenated index as it’s only the one index with less processing and less throwaway rowids/rows to contend with. However it’s more flexible to have single column indexes, especially for Bitmap indexes that are kinda designed to be used concurrently, as concatenated indexes are heavily dependant on the leading column being known in queries.

  • Determine the best width for ListCellRenderer - Multi-column combo box

    Currently, I am having a multi column combo box. In order for the column to align properly during show popup, I use box layout to do so. However, the short coming for box layout is that, the size for each column is fixed. This makes me have a difficulty, when I have a long string to be displayed. The problem is shown through the following screen shoot.
    http://i.imgur.com/4Nfc6.png
    This is because in 2nd column,
    1) All the 3 rows must be in same size so that they are aligned.
    2) But 1st row and 2nd row cell renderer, do not know 3rd row is holding such a long string.
    The code (2 files) to demo this problem is as follow. Is there any way the size of the cell will be adjusted automatically? Yet, all the row will be aligned properly.
    ResultSetCellRenderer.java
    package javaapplication24;
    import java.awt.Color;
    import java.awt.Component;
    import javaapplication24.NewJFrame.ResultType;
    import javax.swing.JList;
    import javax.swing.ListCellRenderer;
    import javax.swing.UIManager;
    * @author yccheok
    public class ResultSetCellRenderer extends javax.swing.JPanel implements ListCellRenderer {
        /** Creates new form ResultSetCellRenderer */
        public ResultSetCellRenderer() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
            jLabel1.setText("jLabel1");
            jLabel1.setMaximumSize(new java.awt.Dimension(88, 14));
            jLabel1.setMinimumSize(new java.awt.Dimension(88, 14));
            jLabel1.setPreferredSize(new java.awt.Dimension(88, 14));
            add(jLabel1);
            jLabel2.setText("jLabel2");
            jLabel2.setMaximumSize(new java.awt.Dimension(100, 14));
            jLabel2.setMinimumSize(new java.awt.Dimension(200, 14));
            jLabel2.setPreferredSize(new java.awt.Dimension(100, 14));
            add(jLabel2);
        }// </editor-fold>
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        // End of variables declaration
        // Do not use static, so that our on-the-fly look n feel change will work.
        private final Color cfc  = UIManager.getColor("ComboBox.foreground");
        private final Color cbc  = UIManager.getColor("ComboBox.background");
        private final Color csfc = UIManager.getColor("ComboBox.selectionForeground");
        private final Color csbc = UIManager.getColor("ComboBox.selectionBackground");
        private final Color cdfc = UIManager.getColor("ComboBox.disabledForeground");
        // For Nimbus look n feel.
        private final Color nimbus_csfc;
             Color c = UIManager.getColor("ComboBox:\"ComboBox.renderer\"[Selected].textForeground");
             // Pretty interesting. Applying "c" directly on the component will not
             // work. I have the create a new instance of Color based on "c" to make
             // it works.
             nimbus_csfc = c != null ? new Color(c.getRed(), c.getGreen(), c.getBlue()) : null;
        private final Color nimbus_csbc;
            Color c = UIManager.getColor("ComboBox:\"ComboBox.renderer\"[Selected].background");
             // Pretty interesting. Applying "c" directly on the component will not
             // work. I have the create a new instance of Color based on "c" to make
             // it works.
            nimbus_csbc = c != null ? new Color(c.getRed(), c.getGreen(), c.getBlue()) : null;
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            final Color _csbc = csbc != null ? csbc : nimbus_csbc;
            final Color _csfc = csfc != null ? csfc : nimbus_csfc;
            this.setBackground(isSelected ? _csbc : cbc);
            this.setForeground(isSelected ? _csfc : cfc);
            jLabel1.setBackground(isSelected ? _csbc : cbc);
            jLabel1.setForeground(isSelected ? _csfc : cfc);
            jLabel2.setBackground(isSelected ? _csbc : cbc);
            jLabel2.setForeground(isSelected ? _csfc : cfc);
            final ResultType result = (ResultType)value;
            jLabel1.setText(result.symbol);
            jLabel2.setText(result.name);
            return this;
    NewJFrame.java
    package javaapplication24;
    import java.awt.Container;
    import java.awt.Dimension;
    import javax.swing.JComboBox;
    import javax.swing.JList;
    import javax.swing.JScrollBar;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    import javax.swing.event.PopupMenuEvent;
    import javax.swing.event.PopupMenuListener;
    import javax.swing.plaf.basic.BasicComboPopup;
    * @author yccheok
    public class NewJFrame extends javax.swing.JFrame {
        public static class ResultType {
             * The symbol.
            public final String symbol;
             * The name.
            public final String name;
            public ResultType(String symbol, String name) {
                this.symbol = symbol;
                this.name = name;
            @Override
            public String toString() {
                return symbol;
        /** Creates new form NewJFrame */
        public NewJFrame() {
            initComponents();
            this.jComboBox1.addPopupMenuListener(this.getPopupMenuListener());
            this.jComboBox1.setRenderer(new ResultSetCellRenderer());
            this.jComboBox1.addItem(new ResultType("Number 1", "Normal"));
            this.jComboBox1.addItem(new ResultType("Number 2", "Normal"));
            this.jComboBox1.addItem(new ResultType("Number 3", "A VERY VERY VERY VERY long text"));
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            jComboBox1 = new javax.swing.JComboBox();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
            jComboBox1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jComboBox1ActionPerformed(evt);
            getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 110, -1));
            pack();
        }// </editor-fold>
        private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
        * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    final NewJFrame frame = new NewJFrame();
                    frame.setVisible(true);
        private PopupMenuListener getPopupMenuListener() {
            return new PopupMenuListener() {
                @Override
                public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                    // We will have a much wider drop down list.
                    adjustPopupWidth(jComboBox1);
                @Override
                public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                @Override
                public void popupMenuCanceled(PopupMenuEvent e) {
         * Adjust popup for combo box, so that horizontal scrollbar will not display.
         * Resize JComboBox dropdown doesn't work without customized ListCellRenderer
         * http://www.camick.com/java/source/BoundsPopupMenuListener.java
         * @param comboBox The combo box
        public static void adjustPopupWidth(JComboBox comboBox) {
            if (comboBox.getItemCount() == 0) return;
            Object comp = comboBox.getAccessibleContext().getAccessibleChild(0);
            if (!(comp instanceof BasicComboPopup)) {
                return;
            BasicComboPopup popup = (BasicComboPopup)comp;
            JList list = popup.getList();
            JScrollPane scrollPane = getScrollPane(popup);
            // Just to be paranoid enough.
            if (list == null || scrollPane == null) {
                return;
            //  Determine the maximimum width to use:
            //  a) determine the popup preferred width
            //  b) ensure width is not less than the scroll pane width
            int popupWidth = list.getPreferredSize().width
                            + 5  // make sure horizontal scrollbar doesn't appear
                            + getScrollBarWidth(popup, scrollPane);
            Dimension scrollPaneSize = scrollPane.getPreferredSize();
            popupWidth = Math.max(popupWidth, scrollPaneSize.width);
            //  Adjust the width
            scrollPaneSize.width = popupWidth;
            scrollPane.setPreferredSize(scrollPaneSize);
            scrollPane.setMaximumSize(scrollPaneSize);
         *  I can't find any property on the scrollBar to determine if it will be
         *  displayed or not so use brute force to determine this.
        private static int getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane) {
            int scrollBarWidth = 0;
            JComboBox comboBox = (JComboBox)popup.getInvoker();
            if (comboBox.getItemCount() > comboBox.getMaximumRowCount()) {
                JScrollBar vertical = scrollPane.getVerticalScrollBar();
                scrollBarWidth = vertical.getPreferredSize().width;
            return scrollBarWidth;
         *  Get the scroll pane used by the popup so its bounds can be adjusted
        private static JScrollPane getScrollPane(BasicComboPopup popup) {
            JList list = popup.getList();
            Container c = SwingUtilities.getAncestorOfClass(JScrollPane.class, list);
            return (JScrollPane)c;
        // Variables declaration - do not modify
        private javax.swing.JComboBox jComboBox1;
        // End of variables declaration
    }Edited by: yccheok on Jan 13, 2011 9:35 AM

    Are these two lines intentionally or is it just a mismatch?
    jLabel2.setMaximumSize(new java.awt.Dimension(100, 14));
    jLabel2.setMinimumSize(new java.awt.Dimension(200, 14));
    2) But 1st row and 2nd row cell renderer, do not know 3rd row is holding such a long string.There is only one cell renderer for all rows, so no need for the rows to know each other.
    To calculate the exact maximum width of column two, you have to check each entry.
    If you can do this BEFORE creating the combo, you could do this in a loop similar to this pseudo code
    FontMetrics fm= jComboBox1.getFontMetrics(jComboBox1.getFont());
    foreach (column2String) {
      int length= fm.stringWidth(column2String);
      if (length>max) max= length;
    }Now you have a max value to dimension jLabel2 in your renderer.
    If you don't fill your combo in one go, but rather at runtime, you have to check at each
    jComboBox1.addItem(...)
    whether the string for label2 is extending the current max, redefine max, and repaint the combo.
    This second approach I haven't done so far, but that's how I would try.

  • Multi Row Update for Tabular Form

    1) I'm trying to understand how the built-in MRU works for tabular forms: While running through every row, does it check for changes before issuing an UPDATE or does it blindly UPDATE every row in the current pagination range?
    2) If I need to write my own Multi Row Update process for tabular forms, could someone give me some tips on how to do that?
    Thanks,
    Pavel

    1) It stored a checksum for each row that it renders. It calculates the checksum again before processing the rows. The UPDATE statement it issues has a predicate like where old_checksum!=new_checksumSo, it only updates the rows that have at least 1 column value that is different (causing the row checksum to be different)
    2) See the howto at http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html

  • Multiple Users - Tabular Forms - Multi Row Update.....

    Greetings All,
    Any comments, assistance, links, or even answers on the following situation would be much appreciated....
    I have a Application Express 4.0 (Could upgrade to 4.1 if it would help this issue)
    I have a wizard generated tabular form on a table, the form will show up to 600 records (rows) on a page.
    Part 1:
    The situation:
    User 1: Opens the form and brings up latest data set.
    User 2: Opens the form and brings up the latest data set.
    User 1: Changes data for record 1
    User 1: Hits submit. The data is saved.
    User 2: Changes data for record 1
    User 2: Changes data for record 2
    User 2: Hits submit. The following error is produced:
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "3EE15D666E9DBDC59D34CE4CFB3950C0", item checksum = "922DA12AE1E3D8856695745C4D2830D2"., update "<Removed> Error Unable to process update.
    When this error occurs no updates get made to the table.
    I understand that row 1 can not be updated, however I would like row 2 (and all other rows where there is no conflict) to be updated. I would then like to be able to highlight in the form the rows that failed to update (And reload the data in them from the DB).
    Is this something I can achieve using my own MRU procedure, or in another way?
    Can anyone point me to a good example, tutorial or book showing how to do this.
    Thanks!

    Thanks for the comments guys.
    I have solved my issue in two different ways. Way one was not so clever, but worked, involving writing my own process for handling multi-row updates and would allow a user to fill in data for multiple rows (say 10) and have only the row with changed data rejected. V2 takes a very different approach, it uses Javascript, AJAX and the DOM model of the form to check when data is changed / updated by the user. Essentially, when a user enters an updateable form element, a AJAX request checks if the data has been changed. If it has, the value in the form is updated, and the color changed to blue to alert the user. When the user updates the data item, and AJAX request posts the new value to the database, where it is inserted. I had to build a bit of a framework to make this useable, and have to use dynamic sql in the database packages, but it work really well for what my users need! There are limitations (Currently it only supports date fields, text fields and drop down lists) but it works for me. It also involves traffic back and forth with the server each time a user moves the focus to a new form element, but it is a very light request and the work to do the select / updates in oracle is all based on a primary ke, so is ver quick.
    Solution 1: (Would need to be made much more elegant):
    1: Create a new text Item called P5_MESSAGE (To display error / success messages)
    2: Create a new process:
    DECLARE
    l_cks wwv_flow_global.vc_arr2;
    j pls_integer := 1;
    vUpdatedCount number := 0;
    vErrorCount number:=0;
    vMessage varchar2(4000):='';
    BEGIN
    select wwv_flow_item.md5(firstname,lastname,age) cks
    BULK COLLECT INTO
    l_cks
    from VA_TEST1 ;
    for i in 1..l_cks.count
    loop
    if htmldb_application.g_fcs(i) != l_cks(i) then
    -- Log error
    vErrorCount:=vErrorCount+1;
    vMessage:=vMessage||'Could not update row with ID:' || htmldb_application.g_f01(i) || '. This data has been updated by another user since you retrieved the data.<br>';
    else
    -- Do insert
    vUpdatedCount:=vUpdatedCount+1;
    update VA_TEST1
    set
    FIRSTNAME = replace(htmldb_application.g_f02(i),'%'||'null%',NULL)
    ,LASTNAME = replace(htmldb_application.g_f03(i),'%'||'null%',NULL)
    ,AGE = replace(htmldb_application.g_f04(i),'%'||'null%',NULL)
    where ID = htmldb_application.g_f01(i);
    end if;
    end loop;
    :P5_MESSAGE := vMessage;
    end;
    Note, this currently updates every row, even if the data is unchanged, this could be fixed by comparing the checksum of the data to be inserted with the checksum of the data in the table, if the same then no need to insert.
    Solution 2:
    Too complex to explain in detail here, if you need to implement this then let me know.

  • How Can I get multi column values from dynamic search help?

    Hi Gurus;
    I'm using dynamic search help in my program.
    I want to get multi column values from search help. But I dont know solution for this issue.
    I'm using F4IF_INT_TABLE_VALUE_REQUEST FM.
    How Can I get multi column values from dynamic search help?
    Thanks.

    Believe it or not, the same FM worked for me in a dynpro. I will try to explain here how it works in custom screen and then you can do your work for other screens or program types. I am not going to write my actual work but will explain in general.
    I have 4 fields (FLD1, FLD2, FLD3, FLD4) and i made the search based on FLD2 and when user click on a line (could be any field), then this would bring the line on to the screens.
    There are like 3 steps.
    You have your value_tab for my fields FLD1, FLD2, FLD3 and FLD4. This is just the data that we pass into the FM. (data: IT_VALTAB type table of ZVAL_TABLE)
    Next map the screen fields into an internal table (data: It_dynpfld type table of dselc ). I also have other internal tables defined  (just to keep it straight, i will be putting here) data:  It_return type standard table of ddshretval.
    Next step is to call the function module. Make sure you have values in IT_VALTAB.
    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
            retfield        = 'FLD2'
            value_org       = 'S'
          tables
            value_tab       = It_VALTAB
            return_tab      = It_return
            dynpfld_mapping = It_dynpfld
          exceptions
            parameter_error = 1
            no_values_found = 2
            others          = 3.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        else.
          perform get_selected_fields tables It_return.
        endif.
    The code within the perform GET_SELECTED_FIELDS  - We need to map the result fields after user selects it. The code goes like this. This is step is to update the dynpro fields.
    I need a internal table as well as a work area here. like,
    data: lt_fields type table of dynpread,
            la_fields type dynpread.
      field-symbols: <fs_return> type ddshretval.
    so fill out LT_FIELDS from the IT_RETURN table
    loop at lt_return assigning <fs_return>.
        la_fields-fieldname = <fs_return>-retfield.
        la_fields-fieldvalue = <fs_return>-fieldval.
        append la_fields to lt_fields.
        clear: la_fields.
      endloop.
    Call the FM to update the dynpro
    call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname               = sy-repid
          dynumb               = '1002' "This is my screen number. You could use 1000 for selection screen (hope so)
        tables
          dynpfields           = lt_fields
        exceptions
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          undefind_error       = 7
          others               = 8.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    good luck

  • Multi row update not occuring

    I have created a tabular form using the wizard. This form will show three columns (and in addition a checkbox). I would like this form to be updateable in only certain instances. Because of that, I select the columns twice. I make one of them updateable, and the other read-only. Then I have a conditional display for the columns, so that the updateable columns are shown if a status variable in my page is 'EDIT' and the read-only columns are shown otherwise.
    The problem is that the multi row update does not occur. If I show one of the read-only columns when in the edit mode, the update is done. Also it is executed if I show one of the editable fields when the page is not in edit mode. But when I show only the editable fields in edit mode, and only the read-only fields when in read-only mode, the process is not run.
    What can I do about this? Why doesn't the multi row update occur?

    An alternative is to control the updates by controlling the buttons. Only show the submit/update button if the status on the page is "EDIT".

  • Pass a Collection of multi-column records from JAVA to Plsql

    Hi,
    I need to pass a Collection of multi-column records(say Employee Id, Employee Name and Employee Address) from a JAVA application to an Oracle package/stored procedure
    for data processing and updates.
    I initially thought of using a pl/sql table as an input parameter, but then I came to know that a pl/sql table can have ONLY one column and an index (can be a String in
    the case of an Associative Array). Please let me know if my understanding is wrong here.
    I then thought of using a PL/SQL table with a RECORD type as an element. But, I came across a documentation that says that, Oracle JDBC does not support RAW, DATE, and PL/SQL RECORD as element types.
    Could you please let me know how I can pass multi-column records from JAVA to an Oracle Stored procedure as an input parameter? Millions of rows would be sent by the JAVA program to the Oracle Stored procedure.
    Any help will be highly appreciated.
    Regards,
    Sunil.

    There are several examples in the " Working with Oracle Collections" from the "JDBC Developer's Guide and Reference". You can either use a Map to create Java objects that are created with the Oracle objects data or the generic oracle.sql.STRUCT interface.
    http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraarr.htm#1047581
    http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraoot.htm#1039477

  • Foreign key constraint on multi-column primary key accepts 1 empty column!?

    Hi, we have a reference table with a two-column primary key. In the child table there is a non-mandatory foreign key constraint to this table. So if both child columns are null it's ok too. But now we see that if one of the two child table columns that build up the foreign key is null, the other column can have any (non-existant in the master-tabel) value you like!? That does not make sense.
    Can anyone explain this to me???
    Regards, Paul.

    Paul, I believe that this is in accordance to the ANSI SQL standard requirement for the treatment of nulls in a multi-column FK. In any case Oracle specifically states this is the way FK work From the 10 Concepts manual, Ch 21 Data Integrity, topic Nulls and Foreign Keys:
    The relational model permits the value of foreign keys either to match the referenced primary or unique key value, or be null. If any column of a composite foreign key is null, then the non-null portions of the key do not have to match any corresponding portion of a parent key. <<HTH -- Mark D Powell --

  • Multi column sorting

    I am wondering if it is possbile to sort data grids in multi
    columns?? For example lets say the data grid simply looks like
    this:
    Name
    Date
    Art 10/29/06
    Chris 12/02/04
    Bob 02/21/07
    Bo 08/08/05
    And i want to sort it in abc order first then within that
    sort(abc order) have does be sorted again by date so that A's will
    stay together, B's and so on...Is this possible and if so how?
    Thanks for all the help

    here is what i have...it crashes after the first click....
    rivate function ctrlCheck(ke:KeyboardEvent):void // checks to
    see if the ctrl key is pressed to do a multicolumn sort.
    if( ke.keyCode == 17) ctrlChecker =true;
    else ctrlChecker = false;
    private function resortColumns(le:ListEvent):void //if there
    is more than one page of results resort the columns and requery,
    else just resort
    colSortedOn = new String("");
    var sortDirection:String = new String("");
    var s:Sort=new Sort();
    var count:int=0;
    var arr:Array=new Array();
    if(le.rowIndex == 0)//get the column sorted on and attach
    that to the query and requery
    if(ctrlChecker==true)
    while(ctrlChecker==true)//while the user is still holding
    the ctrl key
    colSortedOn =
    DataGridColumn(datagrid1.columns[le.columnIndex]).dataField.toString();
    if(DataGridColumn(datagrid1.columns[le.columnIndex]).sortDescending)
    sortLoadDirection = true;
    else
    sortLoadDirection = false;
    arr[count]=new SortField(colSortedOn, true,
    sortLoadDirection)
    count ++;
    for(var i:int =0; i<arr.length; i++)
    s.fields
    =arr
    datagrid1.dataProvider.sort= s;
    datagrid1.dataProvider.refresh();
    else //there is no sort order taking place, the item click
    was something else entirely
    parentDocument.sortCheck = 1;
    }

  • Text query using a Multi Column datastore index slow

    I have created a text index using multi column datastore preference. I have specified two clob columns in my preference. Searching on this new index works, but it is slower than I expected.
    I have done the following comparison:
    My original two clob columns are: DocumentBody and DocumentFields. I have built an individual text index on each column. My new column with Multi Column index is DocumentBodyAndFields;
    I did two queries:
    1. search 'dog' on DocumentBody UNION search 'dog' on DocumentFields;
    2. search 'dog' on DocumentBodyAndFields;
    I would think the second search should be faster than the first one because it is a single query. But this is not the case. The second query is consistently slower than the first query by about 10-20%.
    Things are getting much worse when I search on preceding wildcards. If I search '%job', the multi column index is twice as slow as the first query! I am very confused by this result. Is this a bug?

    I am unable to reproduce the performance problem. In my tests, the search that uses the multicolumn_datastore performs better, as demonstrated below. Can you provide a similar test case that shows the table structure, datastore, index creations, and explain plan?
    SCOTT@orcl_11g> CREATE TABLE your_tab
      2    (DocumentId            NUMBER,
      3       DocumentBody            CLOB,
      4       DocumentFields            CLOB,
      5       DocumentBodyAndFields  VARCHAR2 (1))
      6  /
    Table created.
    SCOTT@orcl_11g> INSERT ALL
      2  INTO your_tab VALUES (-1, 'adog', 'bdog', NULL)
      3  INTO your_tab VALUES (-2, 'adog', 'whatever', NULL)
      4  INTO your_tab VALUES (-3, 'whatever', 'bdog', NULL)
      5  SELECT * FROM DUAL
      6  /
    3 rows created.
    SCOTT@orcl_11g> INSERT INTO your_tab
      2  SELECT object_id, object_name, object_name, NULL
      3  FROM   all_objects
      4  /
    69063 rows created.
    SCOTT@orcl_11g> BEGIN
      2    CTX_DDL.CREATE_PREFERENCE
      3        ('your_datastore', 'MULTI_COLUMN_DATASTORE');
      4    CTX_DDL.SET_ATTRIBUTE
      5        ('your_datastore', 'COLUMNS', 'DocumentBody, DocumentFields');
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> CREATE INDEX your_idx1 ON your_tab (DocumentBody)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  /
    Index created.
    SCOTT@orcl_11g> CREATE INDEX your_idx2 ON your_tab (DocumentFields)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  /
    Index created.
    SCOTT@orcl_11g> CREATE INDEX your_idx3 ON your_tab (DocumentBodyAndFields)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  PARAMETERS ('DATASTORE your_datastore')
      4  /
    Index created.
    SCOTT@orcl_11g> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER, 'YOUR_TAB')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> SET TIMING ON
    SCOTT@orcl_11g> SET AUTOTRACE ON EXPLAIN
    SCOTT@orcl_11g> SELECT DocumentId FROM your_tab
      2  WHERE  CONTAINS (DocumentBody, '%dog') > 0
      3  UNION
      4  SELECT DocumentId FROM your_tab
      5  WHERE  CONTAINS (DocumentFields, '%dog') > 0
      6  /
    DOCUMENTID
            -3
            -2
            -1
    Elapsed: 00:00:00.65
    Execution Plan
    Plan hash value: 4118340734
    | Id  | Operation                     | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT              |           |     4 |   576 |     2 (100)| 00:00:01 |
    |   1 |  SORT UNIQUE                  |           |     4 |   576 |     2 (100)| 00:00:01 |
    |   2 |   UNION-ALL                   |           |       |       |            |          |
    |   3 |    TABLE ACCESS BY INDEX ROWID| YOUR_TAB  |     2 |   288 |     0   (0)| 00:00:01 |
    |*  4 |     DOMAIN INDEX              | YOUR_IDX1 |       |       |     0   (0)| 00:00:01 |
    |   5 |    TABLE ACCESS BY INDEX ROWID| YOUR_TAB  |     2 |   288 |     0   (0)| 00:00:01 |
    |*  6 |     DOMAIN INDEX              | YOUR_IDX2 |       |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - access("CTXSYS"."CONTAINS"("DOCUMENTBODY",'%dog')>0)
       6 - access("CTXSYS"."CONTAINS"("DOCUMENTFIELDS",'%dog')>0)
    SCOTT@orcl_11g> SELECT DocumentId FROM your_tab
      2  WHERE  CONTAINS (DocumentBodyAndFields, '%dog') > 0
      3  /
    DOCUMENTID
            -1
            -2
            -3
    Elapsed: 00:00:00.28
    Execution Plan
    Plan hash value: 65113709
    | Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |           |     4 |    76 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| YOUR_TAB  |     4 |    76 |     0   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | YOUR_IDX3 |       |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("DOCUMENTBODYANDFIELDS",'%dog')>0)
    SCOTT@orcl_11g>

  • Creating Multi-Column API radiogroup based on LOV

    Hi everyone!
    I was wondering whether or not it is possible to create a 3 column radiogroup based on the APEX_ITEM.RADIOGROUP API in APEX 3.0?
    For instance, my radiogroup is based on a user's interest level and is supposed to look like: oTest oProduction oBoth
    The values returned by whichever button is selected is based on a table value.
    I'm having trouble making this multi column instead of 1 column with multiple rows. I need to set these up with an LOV similar to STATIC2:Test;TEST,Production;PROD,Both;BOTH
    I also cannot create this radio group as a page item because they must display based on a query issued by a report region on this page.
    Any ideas // suggestions?
    Thanks,
    Eric
    Edited by: user11685190 on Oct 12, 2009 9:50 AM

    Andy,
    I'm actually going to have a radiogroup within the report column itself. The suggestion you gave is actually why I'm mixed up as to how to do this....I've always used Apex page items to create my radiogroups, and then you can simply add the LOV and change the number of columns and it's all set up for you.
    This radio group is actually going to be within a row queried by the report. The report is essentially a 'checkbox selection screen' that also allows the user to select which interest level they hold for each selection (interest level is represented by this 3-option radio group). Therefore what you're going to see on the screen is ( [] represent checkboxes, o represent radio buttons):
    Banner INB
    []Planned Outage Notification oTest oProduction oBoth
    []Unplanned Outage Notification oTest oProduction oBoth
    Banner Self Service
    []Planned Outage Notification oTest oProduction oBoth
    []Unplanned Outage Notification oTest oProduction oBoth
    My question was mainly geared towards whether or not you can add a static LOV to an API radiogroup (apex_item.radiogroup(1,interest_lvl,blah)), so that it could look like:
    apex_item.radiogroup(1,1:2:3, NULL, 'Test':'Production':'Both') as result.
    The only documentation I can find deals with issuing a single return value to these API radiogroups. I actually need a three column API radiogroup that hold's three different values based on which group member the user selects. If you can only issue one return value per group, I would have to define three under the same global variable except changing the return value and displayed text for each...such as:
    apex_item.radiogroup(1,1,NULL,'Test') || apex_item.radiogroup(1,2,NULL,'Production') || apex_item.radiogroup(1,3,NULL,'Both) which will hopefully display as: oTest oProduction oBoth
    I'm going to have to concatenate some &nbsps in between so my radio group buttons and labels are actually seperated, but this may be the right idea.
    I'm going to toy around with this a little more today, I'll post my results.
    Thanks for your quick responses!
    Eric

  • Check the type of column using powershell within a splist

    hi,
    i have a column called BU in my splist in many site collections.i had created using with lookup datatype and  now  since my design is changed i  want to create this as  a a choice field with few default values. Can anyone please
    help how to check this using powershell? i mean check the  datatype of  column using PS and  if its lookup then need to delete the list and recreate it with choice field. i know hot to create a splist with choice field using PS,
    but  i am unable to get the code for existence of lookup or choice field.
    $web = Get-SPWeb "http://sitename"
    $fieldnamebu= "BU"
    $mysplist = $web.lists["mysplist1"]
    $lookupfieldA="Lookup"
    foreach($sfield in $mysplist.fields)
    # how to check the datatype pf column as lookup
    if ( ##todo#### -eq $lookupfieldA )
    $mysplist.Delete();
    $web.upate();
    create the splist with choice field$spTemplate = $web.ListTemplates["Custom List"] #Create SPTemplate instance of Type Custom List
    $web.Lists.Add("mysplist1", "for approvers", $spTemplate)   #Add list to site$spList = $spWeb.Lists["mysplist1"]    #Get list instance
    $spList.OnQuickLaunch = $True   $spList.Update()    #Update list to reflect changes in site
    $spFieldType = [Microsoft.SharePoint.SPFieldType]::Text      #Get Field type to create
    $spList.Fields.Add("Mymn", $spFieldType, $false)      #Add new field to list}

    HI,
    To get the field types please refer below link...
    foreach ($field in $list.Fields) #Get all fields in lists
    if($spField -eq $field.Title) #if field in lists equals field in views
    Write-Host $spField " | " $field.Type -ForegroundColor Green #Write out each field (column)
    https://gallery.technet.microsoft.com/office/SharePoint-Get-SPFields-49039dc0
    To Create Choice field follow below reference:
    https://social.msdn.microsoft.com/Forums/en-US/8a874677-91cf-41dd-a601-f0dd7fdce213/creating-a-choice-column-via-powershell
    http://adicodes.com/add-fields-to-list-with-powershell-in-sharepoint-2010/
    Don't
    forget to mark it as an Answer if it resolves your issue and Vote Me as helpful if it useful.
    Mahesh

Maybe you are looking for

  • Why does a face show up on my iPad when I have deleted it from aperture

    I am using aperture to tag a modestly large library (about 22,000 photos) all for personal use. I've been going through these photos and tagging faces. As a sort of "holding pen" for faces that I wasn't sure about in the unnamed faces strip at the bo

  • Best maintenence program for Mac Pro

    I was accustomed to using MacJanitor for my G4. I like it simple. I dont leave my computer on all the time. What is recommended for system maintenance for this computer. I dont want anything that can cause accidental problems if I don't know what I a

  • IMac Upgrades

    Hi, I am interested in upgrading my iMac for better video editing. I currently have an intel duo 2GHz with 2GB of ram (667 MHz) and the graphics card shows a ATY Radeon X1600 with VRAM of 128 MB. My question is...what I can I do to improve this set u

  • Image and 2copies report of detail form

    i have a master-detail form working fine, my detail is on separate page, what i required is that an 1: image has to show in this detail region, 2: as soon as user press apply changes/save Page A4 pop up formated with 2-number of copies of same region

  • Extensions Are Not Installed and Then Shown Again

    Hi, I am updating Jdeveloper 11.1.1.1.4 and there are 4 extensions that are not installed and show again every time: Repository Harverster AIA Service Constructor AIA Composite Application Framework 2.4 Fusion Developer Guide update The problem is mu