Update and Case Statement

Dear All,
I got stuck with the following statement. The error "ORA-00904: "DOC"."CRED_RPT_RCPT_IND": invalid identifier" seems make no sense. I checked the column and it looks right to me. Can someone help? Thanks!
SQL> update zz_supplier_documentation A
2 set forma_dcmtn_rcpt_stus_cd =
3 (case
4 when loc.busns_type_cd ='1'
5 and doc.CASH_FLOW_RCPT_IND='Y'
6 and doc.BAL_SHEET_RCPT_IND='Y'
7 and doc.INCM_STMT_RCPT_IND='Y'
8 and doc.SCHDL_L_RCPT_IND='Y'
9 and doc.CRED_RPT_RCPT_IND='Y'
10 then '02' ---for complete
11 else '01' ---for incomplete
12 end
13 )
14 where A.suplr_id in
15 (select doc.suplr_id
16 from cbss.zz_supplier_location loc,
17 cbss.zz_supplier_documentation doc
18 where loc.suplr_id = doc.suplr_id);
and doc.CRED_RPT_RCPT_IND='Y'
ERROR at line 9:
ORA-00904: "DOC"."CRED_RPT_RCPT_IND": invalid identifier
Below is the table definition:
SQL> desc zz_supplier_documentation
Name Null? Type
SUPLR_ID NOT NULL NUMBER(38)
BIDDER_NUM CHAR(7)
NSC_NUM CHAR(10)
CASH_FLOW_RCPT_IND CHAR(1)
BAL_SHEET_RCPT_IND CHAR(1)
INCM_STMT_RCPT_IND CHAR(1)
SCHDL_L_RCPT_IND CHAR(1)
SCHDL_C_RCPT_IND CHAR(1)
CRED_RPT_RCPT_IND CHAR(1)
FORM_10K_RCPT_IND CHAR(1)
EXPNSN_LTR_RCPT_IND CHAR(1)
LGL_NTWRK_MBR_CNTRCT_RCPT_IND CHAR(1)
CRTFCTN_DCMTN_RCPT_IND CHAR(1)
FORMA_DCMTN_RCPT_STUS_CD CHAR(2)
LAST_CHG_USER_ID VARCHAR2(80)
LAST_CHG_DT DATE
FORMB_DCMTN_RCPT_STUS_CD CHAR(2)

Joel,
This is statement that I got an error on. The invalid character error was on line 9:
and doc.CRED_RPT_RCPT_IND='Y'
I do not see any invalid character on this line. So, I am stuck now.
update zz_supplier_documentation A
set forma_dcmtn_rcpt_stus_cd =
(case
when loc.busns_type_cd ='1'
and doc.CASH_FLOW_RCPT_IND='Y'
and doc.BAL_SHEET_RCPT_IND='Y'
and doc.INCM_STMT_RCPT_IND='Y'
and doc.SCHDL_L_RCPT_IND='Y'
and doc.CRED_RPT_RCPT_IND='Y'
then '02' ---for complete
else '01' ---for incomplete
end
where A.suplr_id in
(select doc.suplr_id
from cbss.zz_supplier_location loc,
cbss.zz_supplier_documentation doc
where loc.suplr_id = doc.suplr_id);

Similar Messages

  • Use of the "updlock" hint with update and insert statements

    I have inherited some stored procedures and am trying to figure out why the developers decided to use the "updlock" hint on many of the update and insert statements. I have looked around everywhere and have found only one explanation of why "update...with
    (updlock)" can be useful, namely when a table has no clustered index:
    http://www.sqlnotes.info/2012/10/10/update-with-updlock/ I have found nothing yet that mentions why "insert into...with (updlock)" might be used. I understand why the hint
    might be useful on select statements in some cases, but if all of the tables have clustered indexes, is there any good reason to use it on update and insert statements?
    Thanks,
    Ron
    Ron Rice

    This form of deadlock error can occur on a table which has a clustered index.
    If you are doing updates on a table which has a clustered index and that table also has a nonclustered index and the nonclustered index is used to find the row to update you can see this type of deadlock.  For example create a table with a clustered
    primary key index and a nonclustered index by running
    Create Table Foo(PK int primary key identity, OtherKey varchar(10), OtherData int);
    go
    Insert Foo Default Values;
    go 10000
    Update Foo Set OtherKey = 'C' + Cast(PK As varchar(10))
    Create Unique Index FooIdx On Foo(OtherKey);
    That creates a table with 10000 rows, a clustered index and a nonclustered index.  Then run
    Begin Transaction
    Update Foo Set OtherData = 1 Where OtherKey = 'C5'
    That will use the FooIdx index to find the row that needs to be updated.  It will get a U lock on the index row in the FooIdx index, then an X lock on the row in the clustered index, update that row, then free the U lock on FooIdx, but keep the X lock
    on the row in the clustered index.  (There is other locking going on, but to simplify things, I'm only showing the locks that lead to the deadlock).
    Then in another window, run
    Begin Transaction
    Update Foo Set OtherData = 2 Where OtherKey = 'C5'
    This will get a U lock on the index row in the FooIdx index, then try to get an X lock on the row in the clustered index.  But that row is already exclusively locked, so this second window will wait holding a U lock on FooIdx row and is waiting for
    an X lock on the clustered index row.
    Now go back to the first window and run
    Update Foo Set OtherData = 3 Where OtherKey = 'C5'
    This will once again try to get the U lock on the FooIdx row, but it is blocked by the U lock the second window holds.  Of course the second window is blocked by the X lock on the clustered index row and you have a deadlock.
    All that said, I certainly do not routinely code my updates with UPDLOCK.  I try to design databases and write code so that deadlocks will be rare without holding excessive locks.  The more locks you hold and the longer you hold them, the more
    blocking you will get and the slower your system will run.  So I write code that if a deadlock exception occurs, it is properly handled.  Then if too many deadlocks occur, that is the time to go back to the code to see what changes are needed to
    decrease the number of deadlocks (one way to do that may be to get locks earlier and/or hold them longer. 
    But I wouldn't worry much about this form of deadlock.  It is, in my experience, vary rare.  I don't recall ever seeing it in a production environment.
    Tom

  • Diff b/w IF/ENDIF and CASE statement?

    Hi all,
    Plz let me know the difference between IF and CASE statements.Which one is better to be used in general...and are there any specific situations where we have to go for CASE insted of IF.
    Rgds,
    Reddy.

    Hi,
    Case statement is good for performance wise because here we declare cases
    and according to these cases program will be executed.
    When we use if statement then the cursur goes to in the loop, when ever
    the loop is not complete till then the programme will not execute.
    Thats by in performance basis the case statement is good.
    Let me try and explain using an example...
    1) For IF statement...
    Suppost you have a variable color..and you are checking it against color names.
    then your code will be
    IF COLOR == 'BLUE'.
        statements
    ELSEIF COLOR == 'BLACK'.
        statements.
    ...and so on....
    ENDIF.
    But if you use CASE Statement
    CASE COLOR.
    when 'BLUE'.
       statements.
    when 'BLACK'.
      statements.
    so follows that CASE is easy to use and performance wise is also better.
    Regards,
    Priyanka.

  • Decode and case statement in the update..

    Its is more to it, but I want to check with you guys, the experts on this, this look busy to me, it should be a more simplify way of doing it, do you think will work
    The government decide to change the ethnic codes, and we have to come with certain rules to in our report, anyway, do you think this will work? again It is more to it I declare my variables, this is just one part of the precedure.
    BEGIN
          UTL_FILE.fclose_all;
          v_file_handle := UTL_FILE.fopen (v_out_path, v_out_file, 'a');
          UTL_FILE.put_line (v_file_handle,
                             CHR (10) || TO_CHAR (SYSDATE, 'DD-MON-YYYY HH:MI:SS')
          UTL_FILE.put_line (v_file_handle, 'Entering  spbpers_update');
          SELECT upd_spbpers_upd_cur IS
              spriden_pidm,
              szscapp_birth_state,
              szscapp_birth_city,
              DECODE(szscapp_hisp_or_latino_ind,Y,'2',N,'1'),
              DECODE(szscapp_hisp_or_latino_options,XCM,'2',CUB,'2',MEX,'2',PRI,'2',XSM,'2',ESP,'2',XOH,'2'),  
              DECODE(szscapp_amer_indn_alaska_opt,XAN,'1','1',XCW,'1',XCH,'1',XCK,'1',XNV,'1',XSX,'1'),         
              DECODE(szscapp_amer_indn_alaska_other,XON,'1') (,IND,'1',JPN,'1',KOR,'1',PAK,'1',PHL,'1',VNM,'1',XEA,'1',XIS,'1',XSA,'1'),  
              DECODE(szscapp_asian_options,IND,'1',JPN,'1',KOR,'1',PAK,'1',PHL,'1',VNM,'1',XEA,'1',XIS,'1',XSA,'1'),   ,          
              DECODE(szscapp_other_east_asia,(IND,'1',JPN,'1',KOR,'1',PAK,'1',PHL,'1',VNM,'1',XEA,'1',XIS,'1',XSA,'1'),            
              DECODE(szscapp_other_indian_subcont,XIS,'1'),    
              DECODE(szscapp_other_southeast_asia,XSA,'1'),   
              DECODE(szscapp_blk_or_afr_amer_opt,XAA,'1',XAF,'1',XCB,'1',XOA,'1'),     
              DECODE(szscapp_blk_or_afr_amer_other,XOA,'1'),   
              DECODE(szscapp_natve_hawaian_options,GUM,'1',XHI,'1',ASM,'1',XOP,'1'), 
              DECODE(szscapp_hawaiian_other,XOP,'1'),             
              DECODE(szscapp_white_options,XEU,'1',XME,'1',XOW,'1'),           
              DECODE(szscapp_white_other(XOW,'1')
         FROM
             saturn_midd.szscapp 
         WHERE
         spriden_id =  szscapp_id
         AND  spriden_ntyp_code = 'CAPL'
       IF upd_spbpers_upd_cur%ISOPEN
          THEN
             CLOSE upd_spbpers_upd_cur;
          END IF;
          OPEN upd_spbpers_upd_cur;
          LOOP
             FETCH upd_spbpers_upd_cur
              INTO v_pidm,v_birth_state,v_birth_city,v_latino_ind,v_latino_options,
                   v_indn_alaska_opt,v_indn_alaska_other,v_asian_options,
                   v_other_east_asia,v_other_indian_subcont,v_other_southeast_asia,
                   v_blk_or_afr_amer_opt,v_blk_or_afr_amer_other,v_natve_hawaian_options,           
                   v_hawaiian_other,v_white_options,v_white_other;
             EXIT WHEN upd_spbpers_upd_cur%NOTFOUND; 
             IF upd_spbpers_upd_cur%FOUND
               UPDATE  saturn.spbpers
                           set SPBPERS_ETHN_CODE  = CASE
                   WHEN v_latino_ind            IS NOT NULL THEN (spbpers_ethn_code = v_latino_ind,spbpers_activity_date = sysdate)     
                   WHEN v_latino_options        IS NOT NULL THEN (spbpers_ethn_code = v_latino_options,spbpers_activity_date = sysdate)
                   WHEN v_indn_alaska_opt       IS NOT NULL THEN (spbpers_ethn_code = v_indn_alaska_opt,spbpers_activity_date = sysdate)
                   WHEN v_indn_alaska_other     IS NOT NULL THEN (spbpers_ethn_code = v_indn_alaska_other,spbpers_activity_date = sysdate)
                   WHEN v_asian_options         IS NOT NULL THEN (spbpers_ethn_code = v_asian_options,spbpers_activity_date = sysdate)
                   WHEN v_other_east_asia       IS NOT NULL THEN (spbpers_ethn_code = v_other_east_asia,spbpers_activity_date = sysdate)             
                   WHEN v_other_indian_subcont  IS NOT NULL THEN (spbpers_ethn_code = v_other_indian_subcont,spbpers_activity_date = sysdate)
                   WHEN v_other_southeast_asia  IS NOT NULL THEN (spbpers_ethn_code = v_other_southeast_asia,spbpers_activity_date = sysdate)
                   WHEN v_blk_or_afr_amer_opt   IS NOT NULL THEN (spbpers_ethn_code = v_blk_or_afr_amer_opt,spbpers_activity_date = sysdate)
                   WHEN v_blk_or_afr_amer_other IS NOT NULL THEN (spbpers_ethn_code = v_blk_or_afr_amer_other,spbpers_activity_date = sysdate)
                   WHEN v_natve_hawaian_options IS NOT NULL THEN (spbpers_ethn_code = v_natve_hawaian_options,spbpers_activity_date = sysdate)
                   WHEN v_hawaiian_other        IS NOT NULL THEN (spbpers_ethn_code = v_hawaiian_other,spbpers_activity_date = sysdate)
                   WHEN v_white_options         IS NOT NULL THEN (spbpers_ethn_code = v_white_options,spbpers_activity_date = sysdate)
                   WHEN v_white_other           IS NOT NULL THEN (spbpers_ethn_code = v_white_other,spbpers_activity_date = sysdate)
                   WHEN v_birth_state           IS NOT NULL THEN (spbpers_stat_code_birth = v_birth_state,spbpers_activity_date = sysdate)
                   WHEN v_birth_city            IS NOT NULL THEN (spbpers_city_birth = v_birth_city,spbpers_activity_date = sysdate)
                   WHERE spbpers_pidm = v_pidm;
                  END
                     END IF;
          END LOOP;

    Did the procedure compile ?
    Doesn't look like a right Decode syntax.
    DECODE (col1,'VAL1','This','VAL2','That','ElseThis')
    means
    --Psuedocode
    IF col1 = 'VAL1' THEN 'This'
    IF col1 = 'VAL2' THEN 'That'
    ELSE 'ElseThis'You can use CASE statement Instead of DECODE
    CASE
    when      szscapp_amer_indn_alaska_other
         in ('XON','IND','JPN','KOR','PAK' ..... )  THEN '1'
    when      szscapp_hisp_or_latino_options
         in ('XCM','CUB','MEX','PRI','XSM','ESP','XOH' ...) THEN '2'
    END  SS

  • Update using CASE statement

    Hi
    I have two tables
    employee
    empid empname empaddress valid
    Employeedetails
    empid empname manager
    I would like to validate empname from both the tables using case statement and empid as join and update 'valid' column in employee table to y/n.
    Please help me with the syntax

    Hi,
    Depending on your requirements:
    UPDATE     employee  e
    SET     valid       = (
                     SELECT  CASE 
                                     WHEN  COUNT (*) = 0
                           THEN  'n'
                           ELSE      'y'
                                 END
                     FROM    employeedetails
                     WHERE   empname     = e.empname
    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}

  • Update with case statement problem.

    Hi,
    I have this statement
    update tab_tr set col_rate =
      case
      when col_ern_type in ('031','035','036') then (1.5 * col_rate)
      when col_ern_type in ('041','045','046') then (2 * col_rate)
    end;this statement updated some 2 million rows in the table tab_tr. But the total count of rows for col_ern_type in ('031','035','036', '041','045','046') yeild only around 222642 rows.
    select count(*) from tab_tr where col_ern_type in ('031','035','036', '041','045','046');  --> 222642 rowswhat is the problem with the above update statement.
    Thank you,

    Hi,
    DBA_1976 wrote:
    ... I thought the case statement conditions are counted as the where condition. But ......A CASE expression just takes the place of some other expression, such as a literal, a function, or a column.
    For example, which rows do you think this should update?
    UPDATE  tab_tr
    SET     col_rate  = 100;It would update all rows, of course.
    How about this statement?
    UPDATE  tab_tr
    SET     col_rate  = column_x;Will it only change the rows where column_x are a certain value, or not NULL, or in any way depend on column_x? No, of course not. It will update all rows.
    How about this statement?
    UPDATE  tab_tr
    SET     col_rate  = function_y (col_ern_type);Will it only change the rows where the fucntion returns a certain value? Will it depend on the value in col_ern_type? No, of course not. It calls the function for each row, and whatever the function returns (even if the function returns NULL), that's what goes into col_rate on each row.
    A CASE expression is just something that you can substitute in place of any other expression, such as the literal 100, or the column column_x, or the function function_y in the statements above. Naturally, the value that gets put into col_rate will depend on what the CASE expression returns, but the behavior of the UPDATE statement as a whole will not.

  • Issue with TableAdapter Configuration Wizard and CASE statements

    I am having an issue with using any CASE statements in the select clause for the Table Adapter Configuration Wizard (TCW).  I can take any query without a CASE and it will run fine, but inserting any CASE statement in the Select such as:
    SELECT
    (CASE WHEN :ras_sort = 'D' THEN TO_CHAR(a.TRANS_DATE,'YYYYMMDD')
      WHEN :ras_sort = 'C' THEN  c.CLAIMDEP_NAME
      WHEN :ras_sort = 'A' THEN  TO_CHAR(a.ACCOUNT_NUMBER)
      END) sort1
    FROM xxxx
    causes the TCW to error with "error in list of function arguments, 'THEN' not recognized" and several other errors.  I have tried with and without parameters in the CASE and have tried both forms of the CASE statement.  I have tried multiple queries, all that run with no problem outside of TCW and ODP, but this seems to be a real issue
    Is this a known problem and are there any workarounds that will allow use of the TCW?
    Thanks,
    Dave

    Hi Ashish,
    perhaps you launch the Web service wizard from the wrong location (i.e. not selecting the SEI you want to use). Did you strictly follow the steps described in the <a href="http://help.sap.com/saphelp_nwce10/helpdata/en/44/f36fa8fd1d41aae10000000a114a6b/frameset.htm">documentation</a> for creating the web service?

  • CURSOR and CASE STATEMENT

    Hello All:
    Is it possible to have the CASE Statement in the cursor? If so, could you please show me how to use it? I tried to use it as following but it did not work on Form Builder. I tried it on Oracle SQL *Plus and it worked there.
    CURSOR tbl_chck_cur IS
    SELECT chck_id,
    NVL(sup_chck_id,'') sup_chck_id,
    (CASE WHEN sup_chck_id = null THEN
    (SELECT order_no from tbl_chck_lk where tbl_chck.chck_id = tbl_chck_lk.chck_id ) ELSE
    (SELECT order_no from tbl_chck_lk
    where tbl_chck.chck_id = tbl_chck_lk.chck_id ) END) order_no,
    FROM tbl_chck;
    Thanks in advance for any help.
    KT

    First, get rid of that NVL on sup_chck_id. It does nothing. What do you want it to do, anyway???
    And what is the second table "Tbl_chk_sub" in the from clause?
    Ignoring tbl_chk_sub, this might work:SELECT T1.chck_id,
           T1.sup_chck_id,
           Decode(T1.sup_chck_id, null,LK1.order_no,Lk2.order_no) order_no
      FROM tbl_chck T1,
           tbl_chck_lk LK1,
           tbl_chck_lk LK2
      where LK1.chck_id(+)     = T1.chck_id
        and LK2.sup_chck_id(+) = T1.sup_chck_idIf the above does not work, you will have to find a work-around -- either do the lookup select in the post-query trigger, or create a stored function you can call from the select that returns the correct order_no based on the two columns, sup_chck_id and chck_id.
    Do you know if we can use the SELECT statement inside the CASE statement?Sometimes Forms are several steps behind in adapting new sql features. So it looks like you cannot at this time.

  • Excel and CASE statement.

    Hello Experts,
    I am using a CASE statement on CHAR column as follows:
    CASE WHEN Sales.Ret='Y' THEN 'Returning' ELSE 'New' END
    It gives an error: Odbc driver returned an error (SQLExecDirectW).
    Whereas when I use another CASE statement with Numrical column it is working perfectly.
    CASE WHEN Sales.Amount<40 THEN 40 ELSE 100 END
    Am i missing some Excel data source setting related to CHAR data type?
    My source is MS Excel 2003 and OBIEE is 10.1.3.4.1
    Appreciate any comment, help.
    ~ Ash
    PS: The error details are as follows:*
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: 37000 code: -3100 message: [Microsoft][ODBC Excel Driver] Syntax error (missing operator) in query expression 'case when T46.[Ret] = 'Y' then 'Returning' else 'New' end'.. [nQSError: 16014] SQL statement preparation failed. (HY000)
    SQL Issued: SELECT Sales.Tran_date saw_0, CASE WHEN Sales.Ret='Y' THEN 'Returning' ELSE 'New' END saw_1, Network."Network Name" saw_2, Sales.Amount saw_3 FROM P4UD ORDER BY saw_0, saw_1, saw_2

    Hello Saichand,
    I would like to reconfirm that the CASE statement with Numeric column is working with EXCEL as source.
    The strange thing is that the CASE statement with CHAR column was also working! and from one fine day it it started throwing an error (i thought some source setting might got changed inadvertently ).
    Thank you for your response but I would like to see comments/suggestions from other experts..
    ~ Ash
    Edited by: OBIEE_Ash on Dec 20, 2010 10:27 PM

  • Controlling program flow and case statements

    Hey all, I was wondering, I if I have 40 nested case statements and I want the program to close after they are all done, is it sufficient to wire the "?" for both true and false of the outermost case to the close routine in order to guarantee that all of them will execute? Or is there an even better way using data flow methods?
    -Dobbs

    I'd recommend state machines better than that way or sequences, to controll dataflow better. Example is attached.
    Attachments:
    untitled.vi ‏33 KB

  • APEX_ITEM.MD5_CHECKSUM and Case Statements

    I have an updateable report
    select apex_item.display_and_save(3,parameter) ||
    APEX_ITEM.MD5_CHECKSUM(parameter,value_char,value_number,to_char(value_date,'dd.mm.yyyy'),param_set) ||
    apex_item.hidden(2,rownum) parameter
    ,value_char value_char_current
    ,APEX_ITEM.TEXT(4,value_char,20,128) value_char_new
    ,case when parameter in ('OBJINCID', 'HISTTRANSFERID') then '<span style="color:#000000;font-weight:bold">'||value_number||'</span>'
                else to_char(value_number) end  value_number_current
    ,APEX_ITEM.TEXT(5,value_number,10) value_number_new
    ,case when parameter = 'TRANSFERDAY' then '<span style="color:#000000;font-weight:bold">'||to_char(value_date,'dd.mm.yyyy')||'</span>'
                else to_char(value_date,'dd.mm.yyyy') end value_date_current
    ,APEX_ITEM.DATE_POPUP2(6,value_date,'DD.MM.YYYY','15','10','style=""',null,null,null,null,null,'both',null,'MONTH_AND_YEAR') value_date_new
    ,apex_item.display_and_save(7,param_set) param_set
    ,apex_item.display_and_save(8,param_type) param_type
    ,APEX_ITEM.TEXT(9,jobname) jobname
    ,system system
    ,config config
    ,APEX_ITEM.TEXT(10,parameter) parameter_hid
    ,APEX_ITEM.TEXT(11,value_number) vnhid
    ,APEX_ITEM.DATE_POPUP2(12,value_date,'DD.MM.YYYY','15','10','style=""',null,null,null,null,null,'both',null,'MONTH_AND_YEAR') vdhid
    from etl_job_param
    where config = substr(:P285_CONFIG,instr(:P285_CONFIG,'_')+1)
    and system = :P285_SYSTEMI would like to change my sql for the value_date_new col to
    ,case when parameter = 'TRANSFERDAY' then
    APEX_ITEM.DATE_POPUP2(6,NULL,'DD.MM.YYYY','15','10','style="" disabled="disabled"',null,null,null,null,null,'both',null,'MONTH_AND_YEAR')
    else
    APEX_ITEM.DATE_POPUP2(6,value_date,'DD.MM.YYYY','15','10','style=""',null,null,null,null,null,'both',null,'MONTH_AND_YEAR')  end value_date_newI think I need to change my checksum so if parameter = 'TRANSFERDAY' then use the value from the vdhid column and not value_date_new.
    It is not allowing me to use column alias in the checksum
    How do I do this ?
    Gus

    Well, you could either put the CASE statement in the checksum parameter as well (duplicating logic = bad) or use a factored subquery with the case statment in and alias that column, then reference it in the main query (logic in one place = good).
    Cheers
    Ben

  • How do I use switch and case statements to fill more than one other field?

    Hi all,
    I'm new to the community.
    I'm trying to make an existing form more user friendly for my coworkers. I want to use a switch and case approach in a drop-down list field so that the selection fills two seperate other fields with different info related to the selection.
    I can already do this with one field, but if I add a second target field under an existing case the text doesn't appear there when I make the selection from the dropdown.
    Basically, I'm asking if I can do this:
    switch 
    (sNewSel){
       case "1": // Selection 1    Row2.Field1
    = "text for field 1";
        Row1.Field2 = "text for field 2"; 
        break;
    etc.
    It works if the "row1.field2" option isn't there, but not when it is present.
    Any takers?

    I'm not sure if I will be able to send you the form. There may be too much to redact.
    Would this last bit of code in the cell affect anything?
    if 
    (bEnableTextField)
    {Row2.Field1.access
    = "open"; // enable field
    Row2.Field1.caption.font.fill.color.value= "0,0,0"; // set caption to black
    That is, do I also need to repeat the same thing for the second target cell (Row1.Field2)?
    What would be possible hang ups that would prevent it from working correctly?
    Dave
    By the way, I'm not sure if my other attachment posted. I am trying again.

  • XMLSerialize and case statement

    Hi all,
    I try using case statement on select like that
    SELECT
       xmlserialize(DOCUMENT
          xmlroot(XMLELEMENT(kdpwdocument,XMLATTRIBUTES(
                               'xxxxxxxx' AS sndr,
                               'xxxxxxxx' AS rcvr,
                               'xxxxxxxx' AS "xmlns",
                               'xxxxxxxx' AS "xmlns:xsi",
                               'xxxxxxxx' AS "xsi:schemaLocation"
                               CASE WHEN REPO_STATUS=1 THEN
                                                                              xmlagg(
                                                        XMLELEMENT("regio",
                                                          XMLELEMENT("Inf",
                                                                      XMLELEMENT("Id",
                                                                                 XMLELEMENT("PmryId",'1111'),
                                                                                 XMLELEMENT("ScndryId",'1111')
                              ELSE
                                                                              xmlagg(
                                                        XMLELEMENT("regio",
                                                          XMLELEMENT("Inf",
                                                                      XMLELEMENT("Id",
                                                                                 XMLELEMENT("PmryId",'0000'),
                                                                                 XMLELEMENT("ScndryId",'0000')
                                        END
                  VERSION '1.0" encoding="UTF-8'
        ) AS CLOB)
    FROM REPO
    WHERE 1=1
    but i'm getting error:
    00937. 00000 -  "not a single-group group function"
    Any idea how I can change my query to get results? When I'm using group by repo_status, I'm getting two rows, but that isn't a good result for me

    Solution:
    SELECT
       xmlserialize(DOCUMENT
          xmlroot(XMLELEMENT(document,XMLATTRIBUTES(
                               'xxxxxxxx' AS sndr,
                               'xxxxxxxx' AS rcvr,
                               'xxxxxxxx' AS "xmlns",
                               'xxxxxxxx' AS "xmlns:xsi",
                               'xxxxxxxx' AS "xsi:schemaLocation"
                               xmlagg(
                            CASE WHEN repo_status=1 THEN
                                                        XMLELEMENT("regio",
                                                          XMLELEMENT("Inf",
                                                                      XMLELEMENT("Id",
                                                                                 XMLELEMENT("PmryId",'1111'),
                                                                                 XMLELEMENT("ScndryId",'1111')
                            ELSE
                                                        XMLELEMENT("regio",
                                                          XMLELEMENT("Inf",
                                                                      XMLELEMENT("Id",
                                                                                 XMLELEMENT("PmryId",'0000'),
                                                                                 XMLELEMENT("ScndryId",'0000')
                            END
                  , VERSION '1.0" encoding="UTF-8'
        ) AS CLOB)
    FROM REPO
    WHERE 1=1
    RESULT:
    "<?xml version="1.0" encoding="UTF-8"?>
    <DOCUMENT SNDR="xxxxxxxx" RCVR="xxxxxxxx" xmlns="xxxxxxxx" xmlns:xsi="xxxxxxxx" xsi:schemaLocation="xxxxxxxx">
      <regio>
        <Inf>
          <Id>
            <PmryId>0000</PmryId>
            <ScndryId>0000</ScndryId>
          </Id>
        </Inf>
      </regio>
      <regio>
        <Inf>
          <Id>
            <PmryId>1111</PmryId>
            <ScndryId>1111</ScndryId>
          </Id>
        </Inf>
      </regio>
    </DOCUMENT>

  • Update with case statement

    Hello,
    I want to use case in update statement.
    For example I have a table whose name is Item. There are 20 fields in this table. StockHoldType, Quantity and Amount are three of them.
    I want to update quantity or amount fields according to stockholdtype fields value. If stockholdtype is 1 , I will update quantity field,
    if stockholdtype field is 2 I will update amount field.
    How can I do this?

    upadte table_name
    set Quantity = decode(stockholdtype,1,+new_value+,quantity),
         amount = decode(stockholdtype,2,+new_value+,amount)
    where stockholdtype in (1,2)                                                                                                                                                                                                                                                                                                                                                                   

  • SWITCH and CASE STATEMENT

    i am trying to use switch statement for drawing different shapes by clicking shapes buttons (eg line ,rectangle oval etc) . i have got a method called setDrawMode and i am passing shape value as parameter to this method but nothing happen .all it is doing is drawing with default value.
    my code for clicking button:
    String s = event.getActionCommand();
    if (s.equalsIgnoreCase("LINE"))
    {   mycanvas.setDrawMode(0);}
    else if (s.equalsIgnoreCase("RECTANGLE"))
    {  mycanvas.setDrawMode(1);}
    else if (s.equalsIgnoreCase("OVAL"))
    {  mycanvas.setDrawMode(2);}my setDrawMode method:
    public void setDrawMode(int mode)
    switch (mode)
    case LINE :
    case RECTANGLE:
    case OVAL:
    this.mode = mode;
    break; default:
    throw new IllegalArgumentException();
    }my code for paint method:
    public void paintComponent(Graphics g)
    super.paintComponent(g);
    if (numPoints>0)
    for (int i=0; i<numPoints-1; i+=2)
    switch (mode)
    case LINE:
    g.drawLine(p.x,p[i].y,p[i+1].x,p[i+1].y);
    g.drawLine(p[numPoints-1].x,p[numPoints-1].y,cx,cy);
    break;
    case RECTANGLE:
    g.drawRect(p[i].x,p[i].y,p[i+1].x,p[i+1].y);
    g.drawRect(p[numPoints-1].x,p[numPoints-1].y,cx,cy);
    break;
    case OVAL:g.drawOval(p[i].x,p[i].y,p[i+1].x,p[i+1].y);
    g.drawOval(p[numPoints-1].x,p[numPoints-1].y,cx,cy);
    break;
    values for shapes
    int LINE = 0
    int RECTANGLE = 1
    int OVAL = 2
    please help
    khurram

    what is the point of this switch here?
    public void setDrawMode(int mode)
         switch (mode)
             case LINE :
             case RECTANGLE:
             case OVAL:
             this.mode = mode;
             break;
             default: throw new IllegalArgumentException();
    } This dosn't do anything but asign mode to the global mode, which is why you get the same value every time. You need to do something in the switch and you don't have a break between them so they would all execute anyway. You can try this.
    public void setDrawMode(int mode)
         switch (mode)
             case LINE : this.mode = 0;
             break;               
             case RECTANGLE: this.mode = 1;
             break;
             case OVAL: this.mode = 2;
             break;
             default: throw new IllegalArgumentException();
    }But if your just trying to set a global mode you could just ommit the switch because its redundant
    public void setDrawMode(int mode)
           this.mode = mode;
           // then you could call paint however you call it
           paintComponent(this.getGraphics);
    }

Maybe you are looking for

  • How to send an email with a flash animation?

    I hope someone can help me with this!!! I want to send an animated email, but I want it to be embbeded in the email and not as an attachment. I have placed it in the server and tried to export it as a complex HTML X--it is not working... please, if a

  • How to get MDI back in your Acrobat (from version 9.0 and up!)

    Hi all! I just recently start using Acrobat quite heavly and I realized that the lack of MDI was hogging my taskbar! I search the net and found the MDI vs SDI blog: http://blogs.adobe.com/acrobat/2008/09/mdi_vs_sdi_in_acrobat.html The case is clear,

  • Insert into two tables, how to insert multiple slave records

    Hi, I have a problem with insert into two tables wizard. The wizard works fine and I can add my records, but I need to enter multiple slave table records. My database: table: paper `id_paper` INTEGER(11) NOT NULL AUTO_INCREMENT, `make` VARCHAR(20) CO

  • Ora-3113 when running sql in sqlplus mts. dedicated works fine

    when i try to execute a simple query (return 1 row), from sqlplus (in the server database) by shared connection, i recive ora-3113. by dedicated conection it works fine. environment datas : server side (windows 2003 server; 10.2.0.1). part of my trac

  • Best format for HD imovie export & 'archiving' source video for future

    I'm sort of new to this but your help would be appreciated. I want to make sure I don't mess up and delete any 'precious' moments. I recently purchased a Canon HF100 Camcorder and have been recording various short movies and wanted to 'plan' for the