ORA-01407 with UPDATE using COALESCE function

Hi
We're trying to run the following query as part of an upgrade:
UPDATE LAWSON.NATBALANCE
SET STATEMENT_REQ=(SELECT COALESCE(acm.STATEMENT_REQ,' ')
FROM LAWSON.ARCUSTOMER acm
WHERE acm.NAT_FLAG='N'
AND LAWSON.NATBALANCE.NAT_COMPANY=acm.COMPANY AND
LAWSON.NATBALANCE.NAT_CUSTOMER=acm.CUSTOMER)
But we're getting the following error:
ORA-01407: cannot update ("LAWSON"."NATBALANCE"."STATEMENT_REQ") to null.
I’m confused by this for a couple of reasons. First, the STATEMENT_REQ field in LAWSON.ARCUSTOMER contains no NULLS, and second I thought the whole purpose of the COALESCE function was to return the first non-null result. What am I missing here?
Edited by: ltzwoman on Dec 4, 2012 10:48 AM

Hi,
Welcome to the forum!
Instead of UPDATE, you might prefer to do this with MERGE:
MERGE INTO  lawson.netbalance     dst
USING   (
         SELECT  company
         ,         customer
         ,         COALESCE ( statement_req
                    ) AS statement_req_not_null
         FROM    lawson.arcustomer
     )               src
ON     (   src.company          = dst.nat_company
     AND src.customer     = dst.customer
WHEN MATCHED THEN UPDATE
SET     dst.statement_req     = src.statement_req_not_null
WHERE     dst.statement_req      != src.statement_req_not_null
;You may find this easier to debug and maintain, since in an UPDATE statement, such as the one suggested by Solomon, the sub-query in the SET clause has to be repeated in the WHERE clause.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
If you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002}

Similar Messages

  • Java.sql.SQLException:ORA-01407: cannot update ("WAVESET", "TASK", "XML")

    Hi,
    We are currently facing the above mentioned error while trying to install Sun IdM 7.1 in WebSphere 6.0. The same ear works fine in all my other environments (all are WebSphere 5). This is what we did
    1. Took a copy of the ear thats works.
    2. Extract.
    3. Modified the serverrepository.xml by using the lh command. Use the newly generated xml file in the extracted folder (WEB-INF), Pack it to a new EAR
    4. Configure the datasource that will be used to communicate with the Index repository.
    5. Deploy.
    Deployment completes successfully. However, when we try to run a task, or import file using IdM admin console, we get this error 'java.sql.SQLException:ORA-01407: cannot update ("WAVESET", "TASK", "XML") to NULL'. we even checked the user permissions on this db schema. they all look good.
    We also checked if we are using the right iiop port number in lh command.
    We arent sure what could be the issue. I am not able to simulate this issue in other environment, as they all turn out to be successful.
    any pointers?
    thanks.

    I still think it's a jdbc error.what is your DB platform?
    is you ServerRepository.xml configured with a jndi data source (and that's why you use iiop)? If so then try to create a new connection through a direct DB URL like:
    lh setRepo -tDBTYPE -uURL -Uusername -Ppassword -n -oServerRepository.xml
    and then try to re-run your update command. if it fails again then please post the complete error message.. hope this helps

  • ORA-01407: cannot update ("APEX_040000"."WWV_FLOW_PLUGIN_FILES"."MIME_TYPE)

    Hi,
    I am getting the following error message when I tried to upload .js file (Plugin creation).
    ORA-01407: cannot update ("APEX_040000"."WWV_FLOW_PLUGIN_FILES"."MIME_TYPE") to NULL
    Unable to process row of table WWV_FLOW_PLUGIN_FILES.
    Regards

    Hi Michelle,
    can you please report that in the APEX Listener forum ORDS, SODA & JSON in the Database with your exact version number of the APEX Listener you are using.
    Thanks!
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins

  • ORA-01407: cannot update (string) to NULL

    I've read that one way to avoid ORA-01407 error like in this example ( [DBA-ORACLE.COM SITE|http://www.dba-oracle.com/t_ora_01407_cannot_update_string_to_null.htm] ) is to use additional EXISTS in where condition:
    update ORDERS ord
      set ord.amount = ( select ord.qty * it.item_price
                         from ITEM it
                         where ord.item_id = it.item_id )
    where exists ( select 1
                   from ITEM it
                   where ord.item_id = it.item_id );Execution plan confirms that those similar correlated subqueries are evaluated twice when I substitute 1 with select ord.qty * it.item_price to make them identical. what will happen if between those two evaluations for particular item_id if some commited update/delete happens on ITEM table causing row removal/values change for item_id? How will it influence the UPDATe? will there be any errors etc?
    thank you

    Hi,
    943276 wrote:
    ... what will happen if between those two evaluations for particular item_id if some commited update/delete happens on ITEM table causing row removal/values change for item_id? How will it influence the UPDATe? will there be any errors etc?If you're using Oracle 4 or higher, your UPDATE statement will continue to read the table as it was the moment your statement began. If you begin the statement at 10:00, but the EXISTS sub-query is executed at 10:02, it will see data that other sessions deleted at 10:01, and it will not see data that other sessions inserted at 10:01.
    Apiminov made a good point: MERGE is simpler to code and more efficient to run

  • How to use COALESCE function in Forms 6i?

    Hi folks,
    Please help me out in using function COALESCE in the forms 6i (front-end code).
    My front-end application has got Oracle9i as back-end. At the database server side, in SQl * Plus, the function is executing perfectly but not in Forms6i.
    Please help me out with you suggestions.
    Your favour will be deeply appreciated.
    Cheers, PCZ.

    This is a PL/SQL equivalent to the COALESCE function:
    CREATE OR REPLACE function F_Coalesce
        PC$List  IN VARCHAR2,
        PC$Sep   IN VARCHAR2 DEFAULT ','
      ) Return Varchar2
    Is
    -- PL/SQL function that return the first non-null value
    -- (equivalent to COALESCE SQL function)
    LC$String VARCHAR2(32767) := PC$Sep || PC$List ;
    LI$i      PLS_INTEGER ;
    LI$i2     PLS_INTEGER ;
    LC$Value  VARCHAR2(4000) ;
    LN$Pos    PLS_INTEGER := 1 ;
    BEGIN
    LI$i := INSTR( LC$String, PC$Sep, 1, LN$Pos ) ;
    While LI$i > 0 Loop
        LI$i2 := INSTR( LC$String, PC$Sep, 1, LN$Pos + 1) ;
        IF LI$i2 = 0 Then LI$i2 := LENGTH( LC$String ) + 1 ; END IF ;
        LC$Value := SUBSTR( LC$String, LI$i+1, LI$i2 - LI$i-1 ) ;
         If LC$Value IS NOT NULL Then
             Return LC$Value ; -- return the first non-null value
         End if ;
         LN$Pos := LN$Pos + 1 ;
         LI$i := INSTR( LC$String, PC$Sep, 1, LN$Pos ) ;
    End loop ;
    Return Null ;
    End ;
    /And the test call:
    SQL> set serveroutput on
    SQL>
    SQL> Declare
      2    t varchar2(1) := null ;
      3    v1 varchar2(100) := t || ',' || t || ',A,' || t || ',B' ;
      4    v2 varchar2(100) := t || ',' || t ;
      5    v3 varchar2(100) := 'A,' || t ;   
      6    a varchar2(100) ;
      7  Begin
      8    a := F_coalesce(v1) ;
      9    dbms_output.put_line('result v1 =(' || a || ')');
    10    a := F_coalesce(v2) ; 
    11    dbms_output.put_line('result v2 =(' || a || ')');
    12    a := F_coalesce(v3) ; 
    13    dbms_output.put_line('result v3 =(' || a || ')');   
    14  End;
    15   
    16  /
    result v1 =(A)
    result v2 =()
    result v3 =(A)
    PL/SQL procedure successfully completed.Hope this helps you,
    Francois

  • BOM Update using a function module - 'CSAP_MAT_BOM_MAINTAIN'

    Hi,
    I have problem in updating the item status for a BOM using a function module - 'CSAP_MAT_BOM_MAINTAIN'.
    My goal is reset the Checkbox for 'Indicator: item relevant to production'. When i pass the value ' '[Space] to the structure field 'T_STPO-REL_PROD' it doen't work.
    Do let me know if you come across such problem & what needs to passed as input to reste the checkbox in the BOM.
    Thanks & Regards,
    Bhargava

    PLM wants to manipulate the Indicators u2013 u201CBulk Materialu201D & u201CCost Relevancyu201D in BOM.
    Note: The 2 indicators [u201CBulk Materialu201D & u201CCost Relevancyu201D] are interlinked with each other for a business functionlity given by SAP. So, if we try to set both indicators we get the below SAP standard error.
    E 29127 Bulk material not allowed for items relevant to costing
    SAP Field Name                             RFC Tag       SAP values    PLM values  Meaning for SAP field
    Indicator: bulk material                   BULK_MAT   Space             !                   No
    Indicator: bulk material                   BULK_MAT    X                   X                  Yes
    Indicator: item relevant to costing  REL_COST    Space            !                    Not relevant to costing
    Indicator: item relevant to costing  REL_COST     1                   1                   Not relevant to costing
    Indicator: item relevant to costing  REL_COST     2                   2                   Packaging operation
    Indicator: item relevant to costing  REL_COST     3                   3                   Packaging material
    Indicator: item relevant to costing  REL_COST     X                   X                  Relevant to costing
    To achieve the clear/reset/set value for 2 indicators [u201CBulk Materialu201D & u201CCost Relevancyu201D] from PLM, only eitheir of indicators status needs to sent [i.e 1 indicator status @ a time].

  • How to release a transport request with warnings using a function module?

    Hi,
    I want to release a transport request(which has some warnings) using some function module .
    The warnign that i get when i try to release the Transport Request manually is "not all objects could be locked..."
    Which function module can I use so i can release such a transport request?
    I am currently using TR_RELEASE_REQUEST but I am unable to release the TR, it throws an exception.
    Also i wouls assume that the function module mentioned would take care of releasing all the unreleased task
    under the request.
    Regards,
    Bikash.

    Hello Bikash
    As an alternative (to cope with the warnings) you may use TRINT_RELEASE_REQUEST.
    However, since this fm offers only a single task/request as IMPORTING parameter you need to take care about unreleased tasks yourself. Looking at SE09/SE10 even there you do not have the option the release a request including all its tasks.
    Regards
      Uwe

  • Problems with output using html2fo function

    Hello,
    I have a problem with output when using html2fo function.
    My sample xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <RTECODE>
    <![CDATA[
    <table border="1">
    <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
    </tr>
    <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
    </tr>
    </table>
    ]]>
    </RTECODE>
    Can anybody explain why the rtf template output is different in pdf, rtf, excel ? It looks ok only in pdf.
    Thanks in advance.

    Check these
    http://docs.oracle.com/cd/E23943_01/bi.1111/e22254/create_rtf_tmpl.htm#CHDCEEIJ
    https://blogs.oracle.com/xmlpublisher/entry/html_in_xml_support
    If helps mark
    Edited by: Srini VEERAVALLI on Feb 25, 2013 10:04 AM

  • With out using pivot function need a Query

    Hi
    I am having table which has 7 columns
    data in table:
    ID,Region,area, year-month,  sales_target, actual_sales,
    1, abc,    xyz,   200907,       1000,          500
    2, abc,    pqr,   200908,       2000,         1500
    3, mnr,   xyz,   200907,       3000,          2000
    I need the data in year and  month with out using pivot funtion
    intial
    region, area,    jul,   aug, sep, oct .......jun
    abc,     xyz,    1000,0,     0,    0...         0
    actual
    region, area,    jul,   aug, sep, oct .......jun
    abc,     xyz,    500,   0,     0,    0...         0Thanks

    Here it is
    with d as ( select 1 ID, 'abc' Region, 'xyz' area, 200907 yearmonth,  1000 sales_target, 500 actual_sales from dual
    union all   select 2, 'abc',    'pqr',   200908,       2000,         1500 from dual
    union all   select 3, 'mnr',   'xyz',   200907,       3000,          2000 from dual
    select  region, area,
    max(case extract(month from to_date(yearmonth,'yyyymm')) when 7 then sales_target
    else 0 end ) TGT_JUL
    max(case extract(month from to_date(yearmonth,'yyyymm')) WHEN 8 then sales_target
    else 0 end ) TGT_AUG
    max(case extract(month from to_date(yearmonth,'yyyymm')) WHEN 9 then sales_target
    else 0 end ) TGT_SEP
    from d
    group by  region, area
    REG ARE    TGT_JUL    TGT_AUG    TGT_SEP
    abc pqr          0       2000          0
    mnr xyz       3000          0          0
    abc xyz       1000          0          0You can copy and replicate the results for another one - actual_sales.

  • Update using a Function in select satement

    Hi
    Is it possible to do follwing .
    i have tabele and a custom fucntion , the custome function will update the column(amount) in the table a based on the value pass through the function from the select statement .
    select id, amount , outstanding from a where id=get_update(id) ;
    Now
    Get_update function will return the same id which i am passing and update the amount column to some value in the
    table a .
    when i execute the select satament i cannot see updated data in the amount column in my first executtion , but if run the same satement again i can see the changes reflected . is it possible to get the updated data in the first execution itself.
    function is PRAGMA AUTONOMOUS_TRANSACTION type
    Regards

    Appreciate your response ,
    i am using another tool where i can execute select statements . i know its not gud idea tio use PRAGMA AUTONOMUS , but i will be not havin much data which will be passing across , this is will be used on on deman basis.
    i have table a
    Id , amount
    12 500
    13 600
    Function GET_ID( )
    CREATE OR REPLACE FUNCTION GET_ID ( pid number) RETURN number IS
    PRAGMA AUTONOMOUS_TRANSACTION ;
    tmpVar1 number;
    BEGIN
    update a set amount =800 where id=pid;
    commit;
    select ID into tmpVar1 from a ;
    RETURN tmpVar1;
    END GET_ID;
    select id, amount from a where id=GET_ID(13) ;
    if i run above statement i dont get the updated amount , but fine in second time
    Regards

  • Issue with Update / Overwrite Partner functions after a customer is created

    Hi All,
        I have been using the standard program RFBIDE00 in LSMW to update / insert the business partners. I could update different partners for PY,SH after a customer is created but for only BP one more entry is getting added instead of updating the existing entry
        Could anyone please let me know why this is happening.
    SP     Sold-to party     6353240
    BP     Bill-to party     6353240
    *BP     Bill-to party     6353538*   ENTRY WHICH GOT ADDED
    PY     Payer             6353241
    SH     Ship-to Party     6353240
    Thanks in Advance
    Vijay....

    Hi All,
        I have been using the standard program RFBIDE00 in LSMW to update / insert the business partners. I could update different partners for PY,SH after a customer is created but for only BP one more entry is getting added instead of updating the existing entry
        Could anyone please let me know why this is happening.
    SP     Sold-to party     6353240
    BP     Bill-to party     6353240
    *BP     Bill-to party     6353538*   ENTRY WHICH GOT ADDED
    PY     Payer             6353241
    SH     Ship-to Party     6353240
    Thanks in Advance
    Vijay....

  • Table update error - ORA-01407

    We have these two tables in Database.
    And want to update the first tabel column using second table values.
    Can someone help me with what I am doing wrong here?
    Please see the query I used below and the error I am getting?
    SQL> desc xyz.t_test1
    Name Null? Type
    SAK_FIN_SCHED NOT NULL NUMBER(9)
    SQL> desc dtonse.T_FIN_CYCLE_HISTORY_XWALK
    Name Null? Type
    SAK_FIN_SCHED NUMBER(9)
    NEW_SAK_FIN_SCHED NOT NULL NUMBER(9)
    SQL> update xyz.t_test1 a
    2 set a.SAK_FIN_SCHED =
    3 (select b.NEW_SAK_FIN_SCHED from dtonse.T_FIN_CYCLE_HISTORY_XWALK b
    4 where a.sak_fin_sched = b.sak_fin_sched
    5 and
    6 b.sak_fin_sched is not null);
    set a.SAK_FIN_SCHED =
    ERROR at line 2:
    ORA-01407: cannot update ("XYZ"."T_TEST1"."SAK_FIN_SCHED") to NULL

    Your update statement will update all the rows of the table, even the row for which the subquery doesn't return any row, in which case, the update will set the column to null, where you get the error.
    You should add a where clause to your "update" to be sure to update only the rows for which the subquery return a result.
    update xyz.t_test1 a
    set a.SAK_FIN_SCHED = (select b.NEW_SAK_FIN_SCHED
                           from   dtonse.T_FIN_CYCLE_HISTORY_XWALK b
                           where  a.sak_fin_sched = b.sak_fin_sched
                           and    b.sak_fin_sched is not null)
    where exists (select 1
                  from   dtonse.T_FIN_CYCLE_HISTORY_XWALK b
                  where  a.sak_fin_sched = b.sak_fin_sched
                  and    b.sak_fin_sched is not null);Nicolas.

  • I want single update query without use the function.

    I want to update sells_table selling_code field with max date product_code from product table.
    In product table there is multiple product_code date wise.
    I have been done it with below quey with the use of function but can we do it in only one update query
    without use the function.
    UPDATE sells_table
    SET selling_code = MAXDATEPRODUCT(ctd_vpk_product_code)
    WHERE NVL(update_product_flag,0) = 0 ;
    CREATE OR REPLACE FUNCTION HVL.maxdateproduct (p_product IN VARCHAR2) RETURN NUMBER
    IS
    max_date_product VARCHAR2 (100);
    BEGIN
    BEGIN
    SELECT NVL (TRIM (product_code), 0)
    INTO max_date_product
    FROM (SELECT product_code, xref_end_dt
    FROM product
    WHERE TO_NUMBER (p_product) = pr.item_id
    ORDER BY xref_end_dt DESC)
    WHERE ROWNUM = 1; -- It will return only one row - max date product code
    EXCEPTION
    WHEN OTHERS
    THEN
    RETURN 0;
    END;
    RETURN max_date_product;
    END maxdateproduct;
    Thanks in Advance.

    Hi,
    Something like this.
    update setlls_table st
            set selling_code =(select nvl(trim(product_code)) from 
                                  (select product_code
                                          , rank() over (partition by item_id order by xref_end_dt DESC) rn
                                       from product
                                   ) pr
                                   where rn =1
                                         and pr.item_id = st.ctd_vpk_product_code
                               ) where NVL(update_product_flag,0) = 0 ;As such not tested due to lack of input sample.
    Regards
    Anurag Tibrewal.

  • ORA-01407 when removing a CMP Entity Bean with WLS 9.1

    Hi all !
    I hope you can help me to solve this ?:|
    I'm migrating my application from WLS 8.1 SP3 to WLS 9.1.
    I'm getting now an SQLException when I try to remove a CMP Entity Bean.
    The stacktrace is as follows:
    java.sql.SQLException: ORA-01407: cannot update ("USER"."MY_TABLE"."THE_CMR_FIELD") to NULL
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1120)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1278)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3415)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3498)
         at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:128)
    Of course, I replaced the table and column names above to be more readable ;-)
    The table MY_TABLE has a CMR field called THE_CMR_FIELD. The column is not nullable in the database (by the way, it's an Oracle 9i).
    Everything is fine under WLS8.1
    I tried two different Oracle JDBC drivers (9.2.0.5 and 10.2.0.1.0), but the result is always the same within WLS9.1.
    Any ideas or suggestions (or even questions) are more than welcome!
    Thanks
    Eric

    What's even more weird is that I have what seams to be the same problem on Weblogic 6.1 (SP4).
    Here's the stacktrace:
    <pre>
    javax.ejb.EJBException:
    Start server side stack trace:
    java.sql.SQLException: ORA-01407: cannot update ("SCHEMA"."TIM_WP_DAY_CORE_PERIODS"."TWD_ID") to NULL
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
         at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate(P6LogPreparedStatement.java:183)
         at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:503)
         at package.WorkPatternDayCorePeriods_vd9y46__WebLogic_CMP_RDBMS.__WL_store(WorkPatternDayCorePeriods_vd9y46__WebLogic_CMP_RDBMS.java:2317)
         at weblogic.ejb20.manager.DBManager.flushModified(DBManager.java:438)
         at weblogic.ejb20.internal.TxManager$TxListener.flushModifiedKeys(TxManager.java:552)
         at weblogic.ejb20.internal.TxManager.flushModifiedBeans(TxManager.java:298)
         at weblogic.ejb20.manager.BaseEntityManager.flushModifiedBeans(BaseEntityManager.java:1246)
         at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.flushModifiedBeans(RDBMSPersistenceManager.java:1106)
         at weblogic.ejb20.manager.BaseEntityManager.cascadeDeleteRemove(BaseEntityManager.java:840)
         at weblogic.ejb20.manager.DBManager.remove(DBManager.java:656)
         at weblogic.ejb20.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:97)
         at package.WorkPatternDayCorePeriodsEJB_vd9y46_ELOImpl.remove(WorkPatternDayCorePeriodsEJB_vd9y46_ELOImpl.java:722)
         at package.PersonWorkPatternBC.removeWorkPatternDay(PersonWorkPatternBC.java:571)
         at package.remove(PersonWorkPatternBC.java:708)
         at package.TimPersonCalendarServiceEJB.removeWorkPattern(TimPersonCalendarServiceEJB.java:140)
    </pre>
    In fact I have this setup:
    <pre>
    workpattern 1..n workpatternday -| 1..n dayperiod
    | 1..n daycoreperiod
    </pre>
    And before 'ejbRemove'ing the workpattern I first remove the days and before that the periods and core periods.
    I start with the periods and instead of removing them in the DB he tries to update the FK to the day with '' (p6spy result).
    When I remove the not null constraint on the foreign key everything passes to the day where the workpatternId cannot be set to null.
    He does not throw errors on the coreperiod (where the not null constraint to day is still present).
    When I invert the sequence of deleting
    (first the core periods then the 'regular' periods) he complains about the dayId on the core periods table.
    So it's completely absurd :S
    I hope weblogic 8.1 might solve this problem as this development code is still to be migrated to 8.1 before going in production...
    I would just like to know what's wrong. There are other places with just about the same relationships (CMR and DB) where he does not complain...

  • Using NVL function in subselect of an update

    Hi,
    nvl is not working in my situation
    Here is my select
    SELECT nvl(a.id, 'WAS NULL') FROM table_1 a, table_2 b
    WHERE a.id=b.id;
    Now here I get NULL instead of 'WAS NULL' as I accepted.
    Table a and table b do not have any identical ids, still I need to be a value returned.
    Is there a way?
    Thanks

    Well this works for me:
    SQL> CREATE TABLE table_1 (id INT NOT NULL, val VARCHAR2(10) NOT NULL);
    Table created.
    SQL> CREATE TABLE table_2 (id INT NOT NULL, val VARCHAR2(10) NOT NULL);
    Table created.
    SQL> INSERT INTO table_1 VALUES (1, 'A');
    1 row created.
    SQL> INSERT INTO table_2 VALUES (2, 'B');
    1 row created.
    SQL> UPDATE table_1 t1
      2  SET    val =
      3         ( SELECT NVL(t2.val,'Was NULL') FROM table_2 t2
      4           WHERE  t2.id = t1.id );
    SET    val =
    ERROR at line 2:
    ORA-01407: cannot update ("WILLIAM"."TABLE_1"."VAL") to NULL
    SQL> UPDATE table_1 t1
      2  SET    val =
      3         NVL
      4         ( ( SELECT t2.val
      5             FROM   table_2 t2
      6             WHERE  t2.id = t1.id )
      7         , 'Was NULL');
    1 row updated.
    SQL> SELECT * FROM table_1;
            ID VAL
             1 Was NULL
    1 row selected.

Maybe you are looking for