Update table, exclude NULL rows...

Hi all,
I have 2 tables.
TABLE_A
SRNO VARCHAR2(10)
FLAG VARCHAR2(20)
TABLE_B
SNO VARCHAR2(10)
IND VARCHAR2(20)
I wan to update the FLAG in TABLE_A with IND from TABLE_B where SRNO from both table matches.
here i have written
UPDATE TABLE_A A
SET A.FLAG = (SELECT B.IND FROM TABLE_B B WHERE B.SNO = A.SRNO)
Here, problem is, i do not want to update SRNO in TABLE_A where IND is null in TABLE_B. (or exclude the SNO from innerquery where IND is null)
How can i modify this query to do it?
I have tried using
UPDATE TABLE_A A
SET A.FLAG = (SELECT B.IND FROM TABLE_B B WHERE B.SNO = A.SRNO AND B.IND IS NOT NULL)
when i execute this query, still it updates all rows and updates FLAG to null where IND is null in table B for same SRNO.

Hi,
Try
UPDATE TABLE_A A
SET A.FLAG = (SELECT B.IND FROM TABLE_B B WHERE B.SNO = A.SRNO AND B.IND IS NOT NULL)
WHERE EXISTS (SELECT B.IND FROM TABLE_B B WHERE B.SNO = A.SRNO AND B.IND IS NOT NULL)*009*

Similar Messages

  • Update table all null values to 0 single query

    hi dear ;
    How Can I do , update table all null values to 0 using single query or procedure

    declare @tableName nvarchar(100)
    declare @querys varchar(max)
    set @querys = ''
    set @tableName = 'YOUR TABLE NAME HERE'
    select @querys = @querys + 'update ' + @tableName + ' set ' +
    QUOTENAME(t.[name]) + '=0 where ' + QUOTENAME(t.[name]) + ' is null;'
    from (SELECT [name] FROM syscolumns
    WHERE id = (SELECT id
    FROM sysobjects
    WHERE type = 'U'
    AND [NAME] = @tableName))t
    select @querys
    execute sp_executesql @sqlQuery
    Reference:
    http://stackoverflow.com/questions/6130133/sql-server-update-all-null-field-as-0
    -Vaibhav Chaudhari
    this code is return update TABLE set [FIELD]=isnull([FIELD],''),update TABLE set [FIELD2]=isnull([FIELD2],'')
    I want to use UPDATE TABLE SET FIELD1=ISNULL(FIELD1,0),FIELD2=ISNULL(FIELD2,0),FIELD3=ISNULL(FIELD3,0)  So CUT another update and set statement .

  • Issue with null rows and calc measure in pivot table

    hello;
    id like to ask if anyone encountered a similar behaviour in OBI and if there is woraround for that;
    in my BM i have 2 facts tables; i added in BM logical layer a calculated measure (calc_value) ,which is based on 3 other measures coming from these 2 facts tables
    :calc_value= value1 / (value2+value3) ; value1 coming from fact1 and value2 / vfalue3 coming from fact2
    depending on the chosen dimensions/level in report, the result of the calcuated measure is different ,which is correct;
    the lowest level in fact1 and fact2 are customer/product.
    in Answers when i select this calculated measure into report, a full outer join gets created, joining these 2 facts tables on all the dimensions that were chosen into the report i.e. in my case year/region/customer/product.
    as a result there are null rows created in the db query, if some of these combinations exist in 1st fact table , and do not exist in 2nd fact table and other way round;
    when i display result as a table, i can see the calculated measure only on the lines that are common for both fact tables and this is correct;
    however - when i create a pivot table, and DO NOT select into the pivot the customer/product (so the lowest level), but still select these items into criteria, then the calc_value is not displayed correctly; instead of the value that would be shown as if calculated at the higher level i.e. year/region, simply 0 is displayed;
    i was wondering how this can be corrected, so that OBI displayes in pivot the calc_value as of the level which is shown in pivot (so if i show in pivot year/region/customer/product -> then at this level; if i put customer/product to 'exclude' in pivot, then the level should be year/region);
    i noticed if i filter out at least 1 combination that create null rows then the values are shown correctly in pivot (but the db query still contains null rows), so i tend to think this is presentation issue, not design;
    id appreciate any tips on how to resolve this issue
    OBI vesion: 10.1.3.2
    thx
    rgds

    Hi write a case statement during logical column such that when value is present it takes value else zero for call the values i.e. value1, value2, value3.
    i.e. case when column1 is not null then column1 else 0.
    Then, do the calculation.
    Hope this might helpful for you.

  • How to impdp a specific table excluding rows which are corrupted using impdp

    Hello,
    I need some help with regard to the impdp. I have table which is corrupted and the information of corrupted rows is also available with me now i need to exclude those rows in specific and import the other error free rows.
    Can you please let me know what would be the option to use with impdp.
    Does the QUERY option work with impdp to exclude rows of that particular table.
    Thanks,
    Vinodh

    but import is running for  more than one day but the size of table is huge around 600GB.
    Below you can find the parfile output. How to check if this process is still running. I have used dba_datapump_jobs but no use.
    also truss output says thread is sleeping. Your inputs on this will be much helpful.
    DIRECTORY=DUMPDIR113
    DUMPFILE=expdpA_DDAPTE1_20130403_1003_%U.dmp
    TABLES=A_DDAPTE1.FGBA_JBBB069
    TABLE_EXISTS_ACTION=APPEND
    QUERY=A_DDAPTE1.FGBA_JBBB069:"WHERE RECID NOT IN ('600KR7Feb07-5010009050','FTS100913QA-1','FTS100913QA-11','FTS100913QA-14','FTS100913QA-15','FTS100913QA-16'
    ,'FTS100913QA-17','FTS100913QA-19','FTS100913QA-2','FTS100913QA-25','FTS100913QA-3','FTS100913QA-31','LnLmtTst4Mar06-LMT-1015000','LndPrdMixDec16-4510003850',
    'LndPrdMixDec16-4510004200','LndPrdMixDec30-4400041826','LndPrdMixJan08-1080005191','LndPrdMixJan19-1020043784','LndPrdMixJan24-1300009271','LndPrdMixJan27-20
    80004131','LndPrdMixFeb08-2200008537','LndPrdMixFeb12-2061035772','LndPrdMixFeb23-4010020173','LndPrdMixFeb27-4030043858','LnLmtTst4Mar06-LMT-1015000','LndPdM
    xMr17-1-2040044689','JPMF12309051824404','LndPrdMixMar31-4100030945','LndPrdMixApr26-5020016018','LndPdMxJl09-1-2090030535','JPMJ103090619303826','LndPrdMixSe
    p03-4070048268','LndPrdMixSep24-4400010477','FTS100913QA-14','FTS100913QA-16','FTS100913QA-2','FTS100913QA-17','FTS100913QA-15','FTS100913QA-25','FTS100913QA-
    31','FTS100913QA-11','FTS100913QA-19','FTS100913QA-3','FTS100913QA-1','JPMI22909071376392','LndPrdMixDec16-4510003850','LndPrdMixDec16-4510004200','LndPrdMixD
    ec22-5020009996','LndPdMxJ317-1-2090007173','LndYr2011Jan18-4070033301','LndYr2011Feb02-4400000479','Lndn-11-671BKFeb24-2-1000091345','LndYr2011Mar11-41000182
    11','RPS09090401918928','LndYr2011Feb26-3050008971','LndYr2011Mar214-4400016890','LndYr2011Apr08-4100023458','FTS09091801399914','LndYr2011May26-5010040755','
    LndYr2011Jun01-4030034285','Thrd25BulkJun30-5010048461','CobRun0211Jul08-5020030807','600KCsp511Aug09-4030048518','RlTime250k2Sep09-6010025105','CCS0911060114
    460','3600KR61284NOV24-4030000342','600KR7Feb07-5010009050','FTS09120801346378','600KFWDDATEDMAR09-5010016394','ST10912240129034','MMK0912300369630','600KR701
    MAY04-4100000188','GBA671Tes2RemDor-3000088468','R21210JUL2012R1-3200014672','CBG1002030116505','R312G10OCT2012R3-3070047935','R312G30OCT2012RR1-3090016437','
    SOLARIS07DEC2012RR1-3200011526','LINUX23JAN2013RR1-3020015180','LINUX29JAN2013RR1-3050004304','LINUX04FEB2013RT2-3020045579','MMK10032201164879','FTS100324012
    16453','MMB1003260224532','LINUX14FEB2013RB2-3060003239','LINUX25FEB2013RB1-3100048142','FTS10040802260630','LINUX24MAR2013RB1-4400044062','LINUX23MAY2013RR1-
    3060001245','LINUX10JUN2013RR3-3030035797','LINUX12JUN2013RR2-3060024808','LINUX14JUN2013RR2-3040046259')"
    LOGFILE=YYYY069_20130702LOG.log
    PARALLEL=15
    Thanks,
    Vinodh

  • Updating table rows in Application Module class

    How can I update table rows in Application Module class?
    I'm using JDev 10.1.3 ADF BC, not JSF!
    Thanks.

    There are plenty of examples of doing this in the new ADF Developer's Guide for Forms/4GL Developers on the ADF Learning Center. No need to use raw JDBC.
    http://www.oracle.com/technology/products/adf/learnadf.html
    See Chapters 5 and 6 for a start.

  • Updating a table with billion rows

    It was an interview question, what's the best way to update a table with 10 billion rows. Give me your suggestions. Thanks in advance.
    svk

    The best way to answer questions such as this is NOT with a absolute and specific answer.  Instead, discuss your strategy for approaching the problem.  The first step is to understand your exact requirement.  It is surprising how often people
    write update statements with an under-qualified where clause. NEVER update a row that does not need to be updated.  For example, a statement like:
    update mytable set cola = 'ABC' where id in (1, 45, 212);
    Assuming id is unique for the table and the specified values exist in the table, we know 3 rows will be updated.  Do all of those rows need to be updated?  Think about it.  If cola is already set to 'ABC' for any of those rows, we could ignore
    those rows and make the update more efficient.  To do that, you need to add "and cola <> 'ABC' " to the where clause.   That is just one example of understanding exactly what you need to do - and doing only that which needs to be done.
    Once you understand exactly what you need to do, you need to analyze the impact of the update and identify any potential issues.  Updating a lot of rows can take a lot of time and consume large amounts of log and disk space.  What else is using
    the table?  Can you afford to lock the table for the duration of the update?  Are there concurrency issues, regardless of whether you update in batches or in one single statement?  When using a batch approach, is there an issue if someone runs
    a query against the table (i.e., the result is different from that of the same query run after all updates have been completed)?  Are you changing something which is included in an index?  Are you changing part of the clustered index? 
    Ultimately, every question you are asked is (or should be) designed to test your problem-solving skills and your skillset. IMO, it is relatively easy to improve your skillset of any particular tool, language, or environment.  The other - not so much
    and that is why they are more valuable IMO.

  • Compare table A and table B and update table B ,,,,table B has 300k rows

    Hi,
    I m trying to write a code, I have tables A and table B.
    I need to compare table A and table B , and update table B with one column.
    using joins b/w A&B tables, I selected one record from table A in cursor.
    After Begin I m trying to open cursor and in FOR LOOP
    Im trying to update table B WHERE CURRENT OF Cursor.
    this is erroring out.
    could you let me know on this.
    there is another way like selecting required columns from both table.but i was told to do as above.
    Thanks

    > this is erroring out.
    You haven't posted nearly enough for anyone to help you.  You didn't even tell us what error you are getting.
    So about the only thing we can do is post a generic MERGE statement which you'll have to modify for your use.
    merge into tableB b
    using (select some_key, some_column from tableA where etc.) u
    on (u.some_key = b.some_key)
    when matched then update
    set b.some_column = u.some_column;

  • How to alter or add foreign key constr to table having child rows or data

    Hi,
    I have a table by name DEPT in which the column DEPTNO is a primary key column and have data in it for all the columns . Now I have a EMP table where in the column DEPTNO is not having any constraint including foreign key constraint too. Now i have data in the EMP table for all the columns . now i would like to add the foreign key constraint to DEPTNO column in the EMP table referencing the DEPTNO column in the DEPT table. Both the table do not have any null values .
    I need to add the foreign key without deleting the data in the EMP table.
    Please advice.
    Regards,
    Vinesh

    Hi,
    I need to add the foreign key without deleting the data in the EMP table.Foreign key constraint can have only those values which are present in the primary key of the parent table or null.
    When your tables are populated with values and then you are adding the constraint then,
    the parent table data is only present in child table or null values.
    Example
    SQL> create table emp_bkp as select * from emp;
    Table created.
    SQL> create table dept_bkp as select * from dept;
    Table created.
    SQL> alter table dept_bkp
      2  add constraint pk_deptno primary key(deptno);
    Table altered.
    SQL> select distinct deptno from emp_bkp;
        DEPTNO
            30
            20
            40
            10
    SQL> select deptno from dept_bkp;
        DEPTNO
            10
            20
            30
            40
            55
    SQL>  alter table emp_bkp
      2   add constraint fk_deptno_bkp foreign key(deptno)
      3    references dept_bkp(deptno);
    Table altered.
    SQL> alter table emp_bkp
      2  drop constraint fk_deptno_bkp;
    Table altered.
    SQL> insert into emp_bkp(empno,ename,deptno) values(142,'Fenny',90);
    1 row created.
    SQL> alter table emp_bkp
      2  add constraint fk_deptno_bkp foreign key(deptno)
      3   references dept_bkp(deptno);
    add constraint fk_deptno_bkp foreign key(deptno)
    ERROR at line 2:
    ORA-02298: cannot validate (SCOTT.FK_DEPTNO_BKP) - parent keys not found
    SQL> update emp_bkp
      2  set deptno=null
      3  where empno=142;
    1 row updated.
    SQL> alter table emp_bkp
      2  add constraint fk_deptno_bkp foreign key(deptno)
      3   references dept_bkp(deptno);
    Table altered.
    SQL> insert into dept_bkp (deptno,dname)values(90,'IT');
    1 row created.
    SQL> update emp_bkp
      2  set deptno=90
      3  where empno=142;
    1 row updated.Twinkle

  • Load / Update Table from a .csv file

    Hi All,
    I thought I would just throw this out there..be kind.
    I have a requirement to build a page that allows the user to upload a excel (well I'll have them save it as a .csv) and upate an existing table in their schema.
    I have successfully created a similar page for inserting into an existing table however my update is not working. Then I realized what the Oracle Application Express Tool does that for me on, LOAD DATA page. The feature I like best is that after browsing for the file and clicking next it shows the column header and the row data underneath. I would really like to duplicate the functionality of this page.
    I looked into the flows schema found related procedures , for example wwv_flow_load_excel_data,but I'm lost on how to use them.
    Is there a way to duplicate the LOAD DATA Page and fit it to meet the users requirement?
    Also I have included my coding attempt :
    CREATE OR REPLACE PROCEDURE exceltotable2
    AS
    NAME: exceltotable
    PURPOSE:
    REVISIONS:
    Ver Date Author Description
    1.0 11/17/2008 1. Created this procedure.
    NOTES:
    Automatically available Auto Replace Keywords:
    Object Name: exceltotable
    Sysdate: 11/17/2008
    Date and Time: 11/17/2008, 2:02:03 PM, and 11/17/2008 2:02:03 PM
    Username: (set in TOAD Options, Procedure Editor)
    Table Name: (set in the "New PL/SQL Object" dialog)
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_raw_chunk RAW (10000);
    v_char CHAR (1);
    c_chunk_len NUMBER := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array APEX_APPLICATION_GLOBAL.VC_ARR2;
    v_rows NUMBER;
    v_asset_id NUMBER;
    v_new_location GINOS_LOCATION.ID_LOCATION%TYPE ;
    sql_stmt VARCHAR2 (2000);
    --delete from data_upld;
    BEGIN
    -- Read data from wwv_flow_files</span>
    SELECT blob_content
    INTO v_blob_data
    FROM wwv_flow_file_objects$
         WHERE NAME = 'F32700/scannedforrdc.csv';
         --(used this for testing)
    -- WHERE last_updated = (select max(last_updated) from WWV_FLOW_FILE_OBJECTS$ where UPDATED_BY
    -- = 'ADMIN')
    --and id = (select max(id) from WWV_FLOW_FILE_OBJECTS$ where UPDATED_BY = 'ADMIN');
    v_blob_len := DBMS_LOB.getlength (v_blob_data);
    v_position := 1;
    -- Read and convert binary to char</span>
    WHILE (v_position <= v_blob_len)
    LOOP
    v_raw_chunk := DBMS_LOB.SUBSTR (v_blob_data, c_chunk_len, v_position);
    v_char := CHR (hex_to_decimal(RAWTOHEX(v_raw_chunk)));
    v_line := v_line || v_char;
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved </span>
    IF v_char = CHR (10)
    THEN
    -- Convert comma to : to use wwv_flow_utilities </span>
    v_line := REPLACE (v_line, ',', ':');
    -- Convert each column separated by : into array of data </span>
    v_data_array := APEX_UTIL.string_to_table (v_line);
    -- Update assets with RDC location
    -- First get the current location id of the RDC
    -- Next take each serial number from the spreadsheet and update the location and rack details </span>
    Select id_location into v_new_location from ginos_location gl, ginos_site gs, ginos_agency ga
    where nm_office = 'OCFS Resource Distribution Center' and gl.id_site = gs.id_site
    And gl.id_agency = ga.id_agency And ga.nm_agency ='Office of Children and Family Services';
    -- test with only the serial number/location
    UPDATE GINOS_ASSET SET ID_LOCATION = v_new_location WHERE NM_SERIAL = v_data_array(1);
    -- Clear out
    v_line := NULL;
    v_rows := v_rows + 1;
    END IF;
    END LOOP;
    END;
    Any advice/assistance is always appreciated
    Thanks
    Moe

    Dan
    Thank You for your reply, I actually bookmark your site yesterday when googling this problem.
    I am going to give it a try. I have ran through steps 1 through 4. Step 4 , I modified to my page.
    Just a little more help..
    do I put my update table code in the procedure (step 4) - how do I view and extract the information from the collection?
    DECLARE
    l_blob BLOB;
    PROCEDURE cleanup
    IS
    BEGIN
    DELETE FROM WWV_FLOW_FILES
    WHERE name = :P103_UPLOAD;
    END cleanup;
    BEGIN
    SELECT blob_content
    INTO l_blob
    FROM WWV_FLOW_FILES
    WHERE name = :P103_UPLOAD;
    csv.create_collection_from_blob(l_blob, 'CSV_UPLOAD', 'Y');
    -- I looked in the ginodba schema (the ref schema for the app) for this collection but it's not there
    cleanup;
    EXCEPTION
    WHEN OTHERS
    THEN
    cleanup;
    RAISE;
    END;
    Thanks Again
    MOe

  • Updating Table Columns Dynamically

    Hi Everybody,
    I have created the following procedure to update table columns, which are having 'N/A' to Null.
    PROCEDURE PRC_UPDATE_NA_TO_NULL (p_owner all_tables.owner%TYPE, p_table_name all_tables.table_name%TYPE DEFAULT NULL)
    IS
    TYPE tc_ref_cursor IS REF CURSOR;
    v_tc_ref_cursor tc_ref_cursor;
    TYPE nt_column_name IS TABLE OF all_tab_cols.column_name%TYPE;
    v_nt_column_name nt_column_name;
    v_table_name all_tables.table_name%TYPE;
    v_set_str VARCHAR2(4000);
    v_where_str VARCHAR2(4000);
    v_sql_stmt VARCHAR2(4000);
    BEGIN
    IF p_table_name IS NOT NULL THEN
    OPEN v_tc_ref_cursor FOR
    SELECT a.table_name
    FROM all_tables a
    WHERE a.owner = UPPER(p_owner)
    AND a.table_name = UPPER(p_table_name)
    ORDER BY a.table_name;
    ELSE
    OPEN v_tc_ref_cursor FOR
    SELECT a.table_name
    FROM all_tables a
    WHERE a.owner = UPPER(p_owner)
    ORDER BY a.table_name;
    END IF;
    LOOP
    DBMS_OUTPUT.PUT_LINE('Processing Owner : '||UPPER(p_owner)||'....');
    FETCH v_tc_ref_cursor INTO v_table_name;
    EXIT WHEN v_tc_ref_cursor%NOTFOUND;
    SELECT b.column_name
    BULK COLLECT INTO v_nt_column_name
    FROM all_tab_cols b
    WHERE b.owner = UPPER(p_owner)
    AND b.table_name = UPPER(v_table_name)
    AND b.nullable = 'Y'
    ORDER BY b.column_id;
    IF v_nt_column_name.LAST > 0 THEN
    DBMS_OUTPUT.PUT_LINE('Updating '||v_table_name||'....');
    FOR i IN v_nt_column_name.FIRST .. v_nt_column_name.LAST
    LOOP
    v_set_str := v_set_str||v_nt_column_name(i)||' := NULL, ';
    v_where_str := v_where_str||v_nt_column_name(i)||' = '||'''N/A'''||' OR ';
    END LOOP;
    v_set_str := RTRIM(TRIM(v_set_str),',');
    v_where_str := RTRIM(TRIM(v_where_str),'OR');
    v_sql_stmt := 'UPDATE '||v_table_name||' SET '||v_set_str||' WHERE '||v_where_str;
    EXECUTE IMMEDIATE v_sql_stmt;
    -- EXECUTE IMMEDIATE 'UPDATE '||v_table_name||' SET '||v_set_str||' WHERE '||v_where_str;
    -- EXECUTE IMMEDIATE 'UPDATE :1 SET :2 WHERE :3' USING v_table_name, v_set_str, v_where_str;
    COMMIT;
    v_set_str := NULL;
    v_where_str := NULL;
    DBMS_OUTPUT.PUT_LINE('Finished Updating '||v_table_name||'....');
    END IF;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('Process Over....');
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    DBMS_OUTPUT.PUT_LINE(SQLCODE||':'||SQLERRM);
    END;
    The problem I am facing is that the Execute Immediate statement is not working. I have used the Execute Immediate statement in 3 different ways given in the above procedure, but none of them works and the error comes to the Exception section.
    Kindly let me have your solutions.
    Thanks in advance,
    MAK

    This approach can be dangerous. You are currently trying to update all columns in the tables to null if any of the columns are 'N/A'. Your query does not exclude external tables which may not be updatable. Your other query does not exclude data types that can not include 'N/A' such as number. You might want to move your commit outside the loop as you may end up committing partial updates.
    You might try to capture the SQL that you are generating;
    create table t(col2 varchar2(4000));Then in your package;
    insert into t values(v_sql_stmt);
    -- EXECUTE IMMEDIATE v_sql_stmt;

  • Database trigger cannot read the updating table

    I want to create a database trigger :
    after insert or update on EMP
    for each row
    begin
    select sum(EMP.salary) from EMP WHERE .....
    end;
    However, I got an error is that I cannot read the updating table if the trigger is 'for each row'. Can anyone help me to to this?
    More, I must use 'for each row' trigger for this case.
    null

    I think the SQL statement should be
    strSQL = "SELECT * FROM MaterialLotJobJoint WHERE JobID=" & _
    tempvars!JobID & " AND MatLotID=" & tempvars!MatLotID
    This assumes thatJobID and MatLotID are number fields.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Update table with data from dialog

    Hello,
    I need the problem.
    I'm not update table with inputtext field where data change from dialog.
    This metod is update table.
    public void returnHandlerGoods(ReturnEvent returnEvent) {
    // Add event code here...
    ArrayList<PricatGoods> data = (ArrayList<PricatGoods>) returnEvent.getReturnValue();
    BindingContainer bc = getBindings();
    DCIteratorBinding dcIterBinding;
    // сохранить изменения detail
    dcIterBinding = (DCIteratorBinding) bindings.get("findVMIOrderDetailsIter");
    RowSetIterator s = dcIterBinding.getRowSetIterator();
    System.out.println("Получено товаров " + data.size());
    for (int i =0; i < data.size(); i++){
    Row detailRow = (RowImpl)s.createRow();
    detailRow.setNewRowState(Row.STATUS_INITIALIZED);
    s.insertRow(detailRow);
    s.setCurrentRow(detailRow);
    // detailRow.setAttribute("lineNum",createLineNum(i));
    detailRow.setAttribute("gtin",((PricatGoods)data.get(i)).getGtin());
    detailRow.setAttribute("goodId",((PricatGoods)data.get(i)).getGoodId());
    detailRow.setAttribute("goodName",((PricatGoods)data.get(i)).getGoodName());
    detailRow.setAttribute("sellerarticle",((PricatGoods)data.get(i)).getGoodCode());
    detailRow.setAttribute("buyerarticle",((PricatGoods)data.get(i)).getBuyerArticle());
    detailRow.setAttribute("unit",((PricatGoods)data.get(i)).getUnit());
    detailRow.setAttribute("totalQuantity",0);
    detailRow.setAttribute("acceptedQuantity",0);
    detailRow.setAttribute("taxRate",((PricatGoods)data.get(i)).getVatPercent());
    detailRow.setAttribute("price",((PricatGoods)data.get(i)).getCost());
    detailRow.setAttribute("priceWithoutTax",((PricatGoods)data.get(i)).getCostWithoutVat());
    detailRow.setAttribute("sumWithoutTax",0.0);
    detailRow.setAttribute("totalSum",0.0);
    detailRow.setAttribute("currency",((PricatGoods)data.get(i)).getCurrency());
    System.out.println("Добавление товара \" "+((PricatGoods)data.get(i)).getGoodName()+ "\" с goodCode " +((PricatGoods)data.get(i)).getGoodCode());
    s.closeRowSetIterator();
    AdfFacesContext.getCurrentInstance().addPartialTarget(table2);
    Fields are update good where inputText.readOnly = true.
    Fields are not update good where inputText.readOnly = false. Old data duplicate in new row.
    I have found some posts, but in them is not told accurately as I can solve the given problem.
    How to update a adf table??
    Re: ADF Dialog FrameWork-Table Update Problem
    Whether it is possible to solve the given problem?
    Thx,
    Dema

    If I use outputText that all job's a good. But I don't change these fields. I should have field with change for users.
    Code jspx page for table ===>
    <af:table value="#{bindings.findVMIOrderDetails1.collectionModel}"
    var="row"
    rows="#{bindings.findVMIOrderDetails1.rangeSize}"
    first="#{bindings.findVMIOrderDetails1.rangeStart}"
    emptyText="#{bindings.findVMIOrderDetails1.viewable ? 'Товаров пока нет.' : 'Access Denied.'}"
    selectionState="#{bindings.findVMIOrderDetails1.collectionModel.selectedRow}"
    selectionListener="#{bindings.findVMIOrderDetails1.collectionModel.makeCurrent}"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.table2}"
    id="table2" styleClass="baseTable">
    <af:column sortProperty="lineNum" sortable="false"
    headerText="№"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column19}"
    id="column19">
    <af:inputText value="#{row.lineNum}" simple="false"
    required="true"
    columns="4"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText4}"
    id="inputText4" readOnly="false"
    requiredMessageDetail='Поле "№" обязательно для заполнения'/>
    </af:column>
    <af:column sortProperty="gtin" sortable="false"
    headerText="GTIN"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column20}"
    id="column20">
    <af:inputText value="#{row.gtin}" simple="true"
    required="#{bindings.findVMIOrderDetails1.attrDefs.gtin.mandatory}"
    columns="#{bindings.findVMIOrderDetails1.attrHints.gtin.displayWidth}"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText26}"
    id="inputText26" readOnly="true"/>
    </af:column>
    <af:column sortProperty="sellerarticle" sortable="false"
    headerText="Код товара у поставщика"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column21}"
    id="column21">
    <af:inputText value="#{row.sellerarticle}" simple="true"
    required="#{bindings.findVMIOrderDetails1.attrDefs.sellerarticle.mandatory}"
    columns="#{bindings.findVMIOrderDetails1.attrHints.sellerarticle.displayWidth}"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText27}"
    id="inputText27" readOnly="true"/>
    </af:column>
    <af:column sortProperty="buyerarticle" sortable="false"
    headerText="Код товара у покупателя"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column22}"
    id="column22">
    <af:inputText value="#{row.buyerarticle}" simple="true"
    required="#{bindings.findVMIOrderDetails1.attrDefs.buyerarticle.mandatory}"
    columns="10"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText28}"
    id="inputText28" readOnly="true"
    disabled="false"/>
    </af:column>
    <af:column sortProperty="goodName" sortable="false"
    headerText="Наименование"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column23}"
    id="column23">
    <af:inputText value="#{row.goodName}" simple="true"
    required="true"
    columns="11"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText29}"
    id="inputText29"
    requiredMessageDetail="Поле обязательно для заполнения"
    readOnly="true"/>
    </af:column>
    <af:column sortProperty="itemDesc" sortable="false"
    headerText="Описание"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column24}"
    id="column24" rendered="false">
    <af:inputText value="#{row.itemDesc}" simple="true"
    required="#{bindings.findVMIOrderDetails1.attrDefs.itemDesc.mandatory}"
    columns="#{bindings.findVMIOrderDetails1.attrHints.itemDesc.displayWidth}"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText30}"
    id="inputText30"/>
    </af:column>
    <af:column sortProperty="unit" sortable="false"
    headerText="Ед. изм."
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column25}"
    id="column25">
    <af:inputText value="#{row.unit}" simple="true"
    required="#{bindings.findVMIOrderDetails1.attrDefs.unit.mandatory}"
    columns="#{bindings.findVMIOrderDetails1.attrHints.unit.displayWidth}"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText31}"
    id="inputText31" readOnly="true"/>
    </af:column>
    <af:column sortProperty="currency" sortable="false"
    headerText="Валюта"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column26}"
    id="column26" rendered="false">
    <af:inputText value="#{row.currency}" simple="true"
    required="#{bindings.findVMIOrderDetails1.attrDefs.currency.mandatory}"
    columns="#{bindings.findVMIOrderDetails1.attrHints.currency.displayWidth}"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText32}"
    id="inputText32"/>
    </af:column>
    <af:column sortProperty="totalQuantity" sortable="false"
    headerText="Общее кол-во"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column27}"
    id="column27">
    <af:inputText value="#{row.totalQuantity}"
    required="#{bindings.findVMIOrderDetails1.attrDefs.totalQuantity.mandatory}"
    columns="#{bindings.findVMIOrderDetails1.attrHints.totalQuantity.displayWidth}"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText36}"
    id="inputText36" readOnly="true">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.findVMIOrderDetails1.formats.totalQuantity}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="acceptedQuantity" sortable="false"
    headerText="Кол-во поставки"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column28}"
    id="column28">
    <af:inputText value="#{row.acceptedQuantity}"
    required="true"
    columns="7"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText37}"
    id="inputText37"
    requiredMessageDetail='Поле "Подтвержденное количество "обязательно для заполнения'
    validator="#{backing_documents_outcoming_unprocessing_type_15_edit_01.validatorQuantity}"
    readOnly="false">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.findVMIOrderDetails1.formats.acceptedQuantity}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="taxRate" sortable="false"
    headerText="НДС, %"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column29}"
    id="column29">
    <af:inputText value="#{row.taxRate}"
    required="true"
    columns="4"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText38}"
    id="inputText38"
    requiredMessageDetail='Поле "НДС" обязательно для заполнения'
    validator="#{backing_documents_outcoming_unprocessing_type_15_edit_01.unitValidatorNDS}"
    readOnly="false">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.findVMIOrderDetails1.formats.taxRate}"/>
    </af:inputText>
    </af:column>
    <af:column sortable="false" headerText="Цена"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column34}"
    id="column34">
    <af:column sortProperty="priceWithoutTax" sortable="false"
    headerText="Без НДС"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column31}"
    id="column31">
    <af:inputText value="#{row.priceWithoutTax}"
    required="true"
    columns="6"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText40}"
    id="inputText40"
    requiredMessageDetail='Поле "Цена без НДС" обязательно для заполнения'
    validator="#{backing_documents_outcoming_unprocessing_type_15_edit_01.unitValidatorPriceWithoutTax}"
    readOnly="false">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.findVMIOrderDetails1.formats.priceWithoutTax}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="price" sortable="false"
    headerText="С НДС"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column30}"
    id="column30">
    <af:inputText value="#{row.price}"
    required="true"
    columns="6"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText39}"
    id="inputText39"
    requiredMessageDetail='Поле "Цена с НДС" обязательно для заполнения'
    validator="#{backing_documents_outcoming_unprocessing_type_15_edit_01.unitValidatorPrice}"
    readOnly="false">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.findVMIOrderDetails1.formats.price}"/>
    </af:inputText>
    </af:column>
    </af:column>
    <af:column sortable="false" headerText="Сумма"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column35}"
    id="column35">
    <af:column sortProperty="sumWithoutTax" sortable="false"
    headerText="Без НДС"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column32}"
    id="column32">
    <af:inputText value="#{row.sumWithoutTax}"
    required="true" columns="6"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText41}"
    id="inputText41"
    requiredMessageDetail='Поле "Сумма без НДС" обязательно для заполнения'
    autoSubmit="true"
    valueChangeListener="#{backing_documents_outcoming_unprocessing_type_15_edit_01.changeSum}"
    readOnly="false">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.findVMIOrderDetails1.formats.sumWithoutTax}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="totalSum" sortable="false"
    headerText="С НДС"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.column33}"
    id="column33">
    <af:inputText value="#{row.totalSum}" required="true"
    columns="6"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.inputText42}"
    id="inputText42"
    requiredMessageDetail='Поле "Сумма с НДС" обязательно для заполнения'
    autoSubmit="true"
    valueChangeListener="#{backing_documents_outcoming_unprocessing_type_15_edit_01.changeSum}"
    validator="#{backing_documents_outcoming_unprocessing_type_15_edit_01.unitValidatorTotalSum}"
    readOnly="false">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.findVMIOrderDetails1.formats.totalSum}"/>
    </af:inputText>
    </af:column>
    </af:column>
    <f:facet name="selection">
    <af:tableSelectOne text="Select and"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.tableSelectOne2}"
    id="tableSelectOne2">
    <af:commandLink text="Удалить"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.commandLink5}"
    id="commandLink5"
    action="#{backing_documents_outcoming_unprocessing_type_15_edit_01.deleteRow}"
    styleClass="tableControlButton"
    immediate="false"/>
    </af:tableSelectOne>
    </f:facet>
    <f:facet name="actions">
    <h:panelGroup binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.panelGroup2}"
    id="panelGroup2">
    <af:commandLink text="Добавить"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.commandLink6}"
    id="commandLink6"
    styleClass="tableControlButton"
    immediate="false"
    action="#{backing_documents_outcoming_unprocessing_type_15_edit_01.addRows}"
    useWindow="true" windowHeight="500"
    windowWidth="600"
    returnListener="#{backing_documents_outcoming_unprocessing_type_15_edit_01.returnHandlerGoods}"
    rendered="#{bindings.JdDoctype02rspType.inputValue == 9&amp;&amp;bindings.JdDoctype02orderrspId.inputValue==null}"/>
    <af:commandLink text="Пересчитать" id="commandLink31"
    styleClass="tableControlButton"
    binding="#{backing_documents_outcoming_unprocessing_type_15_edit_01.commandLink31}"
    action="#{backing_documents_outcoming_unprocessing_type_15_edit_01.calc}"
    useWindow="true" immediate="false">
    <af:setActionListener from="#{row.rowKeyStr}"
    to="#{processScope.mainRowKeyStr}"/>
    </af:commandLink>
    </h:panelGroup>
    </f:facet>
    </af:table>

  • Update table with select from another table

    Hallo,
    I'd like to update table b with codes from a mapping table a.
    a has:
    town_id, town_code, town_name
    b has town_code, town_id, town_population, town_zip_code,...
    Table a has all the details - town_id, town_code and town_name and acts as the mapping between town_id and town_code
    In table b, town_code is null. I want to update the column b.town_code with town_code from table a where a.town_id = b.town_id.
    How will the update query look like?
    I tried
    UPDATE B SET town_code = (SELECT A.town_code FROM A,B WHERE A.town_id=B.town_id)
    and I get the error 'single-row subquery returns more than one row'
    Will appreciate your assistance

    This is what I did.
    First, I created and populated the TOWN_INFO table:
    CREATE TABLE "TOWN_INFO"
    (     "TOWN_ID" NUMBER,
         "TOWN_CODE" NUMBER,
         "E_MAIL" CHAR(15 BYTE)
    Table Created.
    insert all
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3024,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3040,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3052,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3065,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3066,'[email protected]')
    select * from dual
    5 rows created.
    The following creates and populates the mapping table:
    CREATE TABLE "TOWN_MAPP"
    (     "TOWN_CODE" NUMBER,
         "TOWN_ID" VARCHAR2(255 BYTE),
         "TOWN_NAME" CHAR(6 BYTE)
    insert all
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3024,'1001','TOWN_1')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3040,'1003','TOWN_3')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3052,'1002','TOWN_2')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3065,'1004','TOWN_4')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3066,'1006','TOWN_6')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3088,'1007','TOWN_7')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3020,'1009','TOWN_9')
    select * from dual
    7 rows created.
    And now the update query:
    UPDATE TOWN_INFO
    SET TOWN_CODE=(SELECT B.TOWN_CODE FROM TOWN_MAPP B, TOWN_INFO C
    WHERE B.TOWN_ID=B.TOWN_ID)
    SET TOWN_CODE=(SELECT B.TOWN_CODE FROM TOWN_MAPP B, TOWN_INFO C
    ERROR at line 2:
    ORA-01427: single-row subquery returns more than one row
    Thanx in advance
    Edited by: user9954260 on Apr 13, 2010 7:40 AM
    Edited by: user9954260 on Apr 13, 2010 7:44 AM

  • Updating table cell

    Hi,
    I have a requirement for my application. I need to display a timer inside the cell of JTable. The table will be displaying records of multiple users visiting the site. The column should display the total time spent on the page. I am using a customized Table Model. How can I go about it?
    Thanks,
    Ajit

    Hi,
    See the following coding.
    In short,
    &lt b &rt tableModel.fireTableCellUpdated(row,column); &lt /b &rt
    raises the event. So that JTable will listen that event, and updates
    that particular cell only.
    You can create a thread, that keeps track of website visiting
    log of all persons. If the time change, you can invoke that method.
    import javax.swing.*;
    import javax.swing.border.DefaultTableModel;
    public class MyModel extends DefaultTableModel
    Object [] items;
              public MyModel(Object [] items) {
                   this.items=items;
              public int getColumnCount() {
                   return 2;
              public int getRowCount() {
                   return 4;
              public Object getValueAt(int row,int column) {
                   // The first column is fixed Item 1, Item 2, Item 3 etc.
                   if(column==0)
                        return "Person "+(row+1);
                   // The second column varies with "items".
                   else
                        return items[row]+" seconds";
    public static void main(String []args) {
              JFrame f=new JFrame("Testing single cell editor");
              final Object items[]=new Object[]{"1","2","3","4"};
              final MyModel model=new MyModel(items);
              // A table with 2 rows and 2 columns
              JTable table=new JTable(model);//new OurTableModel());
              // Set our editor as table's editor
              //table.setDefaultEditor(Object.class,new SingleCellEditor());
              // Add to a scroll pane
              JScrollPane pane=new JScrollPane(table);
              pane.setBounds(50,50,200,200);
              f.getContentPane().setLayout(null);
              f.getContentPane().add(pane);
              // Close on exit
              f.setDefaultCloseOperation(3);
              // Show the frame
              f.show();
              Thread t=new Thread() {
                   public void run() {
                        while(true) {
                                  try {
                                       Thread.sleep(1000);
                                       items[2]=""+(Integer.parseInt(""+items[2])+1);
                                       model.fireTableCellUpdated(2,1);
                                  catch (InterruptedException ignored)     {
              t.start();
    See that there my be compilation errors. But the logic is same. The same
    I applied and got it.
    Bye.. Bye..

  • Load fact table with null dimension keys

    Dear All,
    We have OWB 10g R2 and ROLAP star schema. In our source system some rows don’t have all attributes populated with values (null value), and this empty attributes are dimension (business) keys in star schema. Is it possible to load fact table with such rows (some dimension keys are null) in the OWB mappings? We use cube operator in mappings.
    Thanks And Regards
    Miran

    The dimension should have a row indicating UNKNOWN, this will have a business key outside of the normal range e.g. -999999.
    In the mapping the missing business keys can then be NVL'd to -999999.
    Cheers
    Si

Maybe you are looking for

  • IDOC: Status (Error/Success/information)report to Sender system

    How would one send a message(error/success/information) to the sending(external) system to inform them of the statuses of the messages they've sent to our SAP system?

  • Locating Final Cell In a SUMIF Statement

    I've found out how to locate the final cell in a column with the OFFSET function and how to locate the one right before it as well. =OFFSET(A1, COUNT(A)-1, 0) What I'm trying to do is a little bit more complicated. I have 3 columns: A (Date), B (Cate

  • HT5470 adding a playing song to playlist

    How do i add a song I'm listening to to a current playlist

  • Differences in sync method?

    I want to sync music and photos manually. The apple tech told me to leave all items in the Summary tab unchecked. What is the difference if I leave them all unchecked or just check the "Manually manage music..."?

  • "java.lang.NoClassDefFoundError "Error message

    Could someone please me out with regards to the below shown error messages? I successfully compiled a java program called "HelloWorld.java" but got the error messages below when i tried to run/execute the java program in question. How could i rectify