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

Similar Messages

  • 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.

  • Booleans to control programming flow

    Is it ok to use booleans within an object to control program flow in an Object Oriented approach?
    For eg: I have 2 tables in the database which are related. Some times both the tables need to be updated, other times, just 1 table.
    One approach would be to have 2 separate methods in the Data Acces object which handle these situtions, as this seems to be cleaner. However, another approach would be to send all the data along with a boolean to the Data Access Object and let the Data Access object make the decision of which tables to update by checking the boolean.
    Please tell me which approach is better and more Object oriented.

    1. How often will the Two tables be updated together.(Not a major factor)
    2. Keep both methods you mentioned.
    3. Create a new method that takes the boolean and the data to update.
    and use this in it:
        (boolean)?FirstMethod:SecondMethod;
       If boolean is true then it calls FirstMethod else SecondMethod.
    Anyone else think of anything?

  • Programming catching exceptions to control program flow.

    Hello,
    I have the following snippet:
         public List subList(int fromIndex, int toIndex) {
              PGSearchEngineList subList = new PGSearchEngineList();
              for (int index = fromIndex; index < toIndex; index++) {
                   try {
                        subList.add(this.get(index));
                   } catch (IndexOutOfBoundsException e) {
                        return subList;
              return subList;
         }Notice that I use a try catch to catch a IndexOutOfBoundsException and to control program flow. Is this a bad practice?
    Julien Martin.

    I believe I read once that you shouldn't code an exception to deal with a condition that you could reasonably expect to occur. There is some sample code for the value list handler on the j2ee patterns page that deals with search result paging in a little "cleaner" way:
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html
    Hope this helps.
    Amber

  • Help with program flow and timing a loop please

    I'm working on an application that will display vibration data on several tabs.  1 tab displays the time waveform, another a running RMS value, another an FFT etc.
    On another tab I want the user to have the option of streaming the data to disk for 'x' number of seconds.
    I created a sub-vi with a flat sequence structure.
    The first frame open/creates a file.  The second frame gets the current time in seconds and adds 'x' seconds to it.  The third frame  contains a while loop with a "Get Current Time in Seconds" and a  "Write to Binary File" which executes while the current time is less than the "previous current time plus 'x'".
    This sub-vi is in a while loop that is called when a "capture data" button is pressed.
    My problem is that the rest of the program (waveform, RMS, FFT displays) stops executing when the while loop / sub-vi is executing.
    This can be seen via the "TEST" indicator that doesn't update.
    When the program flow goes back to the rest of the program I get an error 'cause the buffer has over-flown (ed)
    I'm really new at this so any help is greatly appreciated.
    I've attached images of the main vi (Project3.pdf) and the sub-vi containing the Flat Sequence (WriteToDisk.pdf)
    I can attach the actual vis if it helps.
    Thanks,
    Erik
    Attachments:
    Project3.pdf ‏189 KB
    WriteToDisk.pdf ‏85 KB

    The behavior you're seeing is by design. There are two solutions to your problem:
    Place the write to file in a separate loop that runs in parallel to your main loop. Thus, your "Project3" VI would have two loops. One is the data acquisition, the other is the streaming to file. You should not create data dependencies between the loops that would cause one loop to wait until the other is done. You want both running in parallel. You can stop both loops with the same stop button. With this method you can use local variables to get the Time Waveform data as you're doing now.
    Launch the stream to file VI dynamically. This basically uses the VI Server to start a subVI and then immediately return to the caller. The subVI is then running on its own. There are examples that ship with LabVIEW that show you how to do this. You would have to have the subVI monitor something to determine if it should stop should the main program stop.
    The first option would be the easiest to implement in your case. The second is more complex, but leaves you with one loop.

  • 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

  • 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

  • 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 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);

  • 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);
    }

  • Query cost and CASE statement

    Hi, I'm working on a performance issue for a customer.
    I'm tuning some suspect SQL that uses complex DECODE statements to perform IF/THEN/ELSE logic.
    I've taken a statement and rewritten it using CASE however what I've noticed is the cost of the query execution plan has increased dramatically as a result. N.B. I haven't changed the WHERE clause of the query as yet, just replaced one DECODE with the equivalent CASE.
    The db version is 9.2.0.4. Does anyone know of issues with the performance of CASE as opposed to DECODE. I'm wondering should I leave the DECODEs as is even though they're way too complicated.
    Tks,
    Paul.

    Here's an example of a DECODE:
    nvl(count(distinct decode
    (decode(sign(ords.dwh_created_date_id-:v_start_cycle_id),1,1,0,1,-1,0) *
    decode(sign(:v_end_cycle_id-ords.dwh_created_date_id),1,1,0,1,-1,0),1,ords.dwh_order_id,NULL)),0) calc1
    The equivalent CASE I've coded is:
    NVL(COUNT(DISTINCT(CASE WHEN (ords.dwh_created_date_id BETWEEN :v_start_cycle_id AND :v_end_cycle_id)
    THEN
    ords.dwh_order_id
    ELSE
    NULL
    END)),0) calc1
    I've been doing further testing with an amended WHERE clause and did run both CASE and DECODE versions. The performance difference between the two was negligible. So it seems (as I'd hoped) that the amendment of the execution path doesn't appear to be affected by CASE even though Oracle reports the query cost of it is higher.
    It is slightly confusing though. Is the query cost in this case a red herring ?

Maybe you are looking for

  • Error while accessing JSP deployed on Oracle AS

    Hi, I have developed an application and deployed in on the oracle AS 10.1.2 In my application i have a Jsp on which i have the following code <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "

  • Problem configurin​g WSN network in MAX

    HI, I am facing this problem suddenly in using my NI 9792 gateway .The module is getting detected in MAX  It is that I am not able to find the Node option under devices and interfaces of the gateway in MAX. I am using LV2010 and NI WSN 1.2. Correspo

  • NULL binds with dbms_xmlgen - exception raised

    Hi, I am using the following code extract to get an xml string xmlCtx := dbms_xmlgen.newContext(l_sql_str); dbms_xmlgen.setNullHandling(xmlCtx, dbms_xmlgen.empty_tag); dbms_xmlgen.setbindvalue(xmlCtx,'RUN_ID', p_run_id); dbms_xmlgen.getxml(xmlCtx, l_

  • I need a mechanism to expose action script class reference to java script

    I need a mechanism to expose action script class reference to java script

  • Won't open files with default application

    When I try to open a file it opens preview instead of the default application and does not actually open the file! I have tried changing the default application but it does not help.  How can I fix this?