Help with a decode

I need to decode to 4 different columns.....basically pivot from rows to columns.
current table setup:
columns:
vin, Command_id, command_result, status
I need to say where command_id for a vin = LT_FT_TR_PR and status = 1
show a column called LF_STATUS with the value of 1 in it
basically
vin, LT_FT_TR_PR, LF_STATUS will be the columns.
LT_FT_TR_PR is already decoded to be a column header with the corresponding command_result as it's value.

try to post some sample data and output to further analyze your requirements.
for pivot maybe this example might be of some help:
SQL> select * from pivot_tab;
      COL1 COL2
         1 a
         1 b
         1 c
         2 h
         2 h
SQL> select p.col1,
  2         substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
  3         as col2
  4    from (select col1,
  5                 col2,
  6                 row_number() over (partition by col1 order by col1, col2) rn
  7            from pivot_tab) p
  8  start with p.rn = 1
  9  connect by p.rn = prior p.rn + 1
10  and prior p.col1 = p.col1
11  group by col1;
      COL1 COL2
         1 a,b,c
         2 h,h
SQL>

Similar Messages

  • Help with Nesting DECODE statements

    Hello. I'm trying to write a sql script to generate data report for payments. I need to incorporate specific conditions to SUPPRESS BLANK ADDRESS field lines. I am pulling Address_Line1, Address_Line2, Address_Line3, plus CITY, STATE, ZIP as Address_Line4. If any fields are blank, I need to suppress the blank line and move the other lines up.
    Here are my IF, THEN, ELSE conditions. There are 9 possible scenarios that I have identified. Can you please help me write this in SQL with the DECODE function?
    IF CITY||STATE||ZIP IS NULL               
    THEN AD1='12115 Rainbow Road', AD2='Hartford Heights, MO 60226'               
    ELSE               
         IF ADDRESS_LINE1 IS NULL          
              IF ADDRESS_LINE2 IS NULL     
                   IF ADDRESS_LINE3 IS NULL
                   THEN USE HOME ADDRESS
                   ELSE vAD1=ADDRESS_LINE3, vAD2=CITY||STATE||ZIP
                   ENDIF
              ELSE     
                   IF ADDRESS_LINE3 IS NULL
                   THEN vAD1=ADDRESS_LINE2, vAD2 = CITY||STATE||ZIP
                   ELSE vAD1=ADDRESS_LINE2, vAD2=ADDRESS_LINE3, vAD3=CITY||STATE||ZIP
                   ENDIF
              ENDIF     
         ELSE          
              IF ADDRESS_LINE2 IS NULL     
                   IF ADDRESS_LINE3 IS NULL
                   THEN vAD1=ADDRESS_LINE1, vAD2=CITY||STATE||ZIP
                   ELSE vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE3, vAD3=CITY||STATE||ZIP
                   ENDIF
              ELSE     
                   IF ADDRESS_LINE3 IS NULL
                   THEN vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE2, vAD3=CITY||STATE||ZIP
                   ELSE vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE2, vAD3=ADDRESS_LINE3, vAD4=CITY||STATE||ZIP
                   ENDIF
              ENDIF     
         ENDIF          
    ENDIF               
    This what I've got so far...
    DECLARE
      vADR1
      vADR2
      vADR3
      vADR4
    BEGIN
    SELECT
    DECODE(
    END;
    /

    Hi,
    Here is the code along with some sample data. I substitute the "+" symbol for "/" becuase some addresses where using "c/o" in the address line.
    The address fields are null, as shown by the query below (ref query results below):
    SQL> select address_line1
      2  from po.po_vendor_sites_all
      3  where address_line1='3457 SOLUTIONS CENTER'
      4  and address_line2 is null;
    ADDRESS_LINE1
    3457 SOLUTIONS CENTERHere is the script:
    WITH got_delimited_list AS
    SELECT address_line1 || ' +' ||
    address_line2 || ' +' ||
    address_line3 || ' +' ||
    city ||', ' || state ||'  ' || zip AS delimited_list
    FROM po.po_vendor_sites_all
    SELECT REGEXP_SUBSTR (delimited_list, '[^+]+', 1, 1) AS vad1
    , REGEXP_SUBSTR (delimited_list, '[^+]+', 1, 2) AS vad2
    , REGEXP_SUBSTR (delimited_list, '[^+]+', 1, 3) AS vad3
    , REGEXP_SUBSTR (delimited_list, '[^+]+', 1, 4) AS vad4
    FROM got_delimited_list;Sample of the data records returned:
    VAD1
    VAD2
    VAD3
    VAD4
    3457 SOLUTIONS CENTER
    CHICAGO, IL  60677-3004
    VAD1
    VAD2
    VAD3
    VAD4
    5172 EAGLE WAY
    CHICAGO, IL  60678-1517
    VAD1
    VAD2
    VAD3
    VAD4
    RETAILERS' OCCUPATION TAX
    SPRINGFIELD, IL  62796-0001
    VAD1
    VAD2
    VAD3
    VAD4
    DEPT. NUMBER 478150
    P.O. BOX 790100
    ST LOUIS, MO  63179-9933
    VAD1
    VAD2
    VAD3
    VAD4
    P.O. BOX 62251
    BALTIMORE, MD  21264-2251
    VAD1
    VAD2
    VAD3
    VAD4
    P.O. BOX 660481
    DALLAS, TX  75266-0481
    VAD1
    VAD2
    VAD3
    VAD4
    3525 PIEDMONT RD.
    BUILDING FIVE
    SUITE 300
    ATLANTA, GA  30305

  • Help with Select Decode Round

    Hi, If anyone could help me with this. I need to round all these numbers in the DECODE but without repeating ROUND.
    This way works:
    SELECT title "Title", category "Category",retail "Current Price",
    DECODE(category,
    'COMPUTER',(ROUND(retail * 1.1,2)),
    'FITNESS', (ROUND(retail * 1.15,2)),
    'SELF HELP', (ROUND(retail * 1.25,2)),
    (ROUND(retail * 1.03,2)))"Revised Price"
    FROM books
    ORDER BY category, title;
    But I need something more like this:
    SELECT title "Title", category "Category",retail "Current Price",
    DECODE (ROUND((category,
    'COMPUTER',retail * 1.1,
    'FITNESS', retail * 1.15,
    'SELF HELP', retail * 1.25,
    retail * 1.03)"Revised Price"),2)
    FROM books
    ORDER BY category, title;
    so that ROUND is not repeated more than once..they all need to be rounded to two decimal places.
    any help would be great. Thanks

    your second is close. You need to round the decode statement. like this:
    SELECT title "Title", category "Category",retail "Current Price",
           ROUND(DECODE(category, 'COMPUTER',retail * 1.1,
                                  'FITNESS', retail * 1.15,
                                  'SELF HELP', retail * 1.25,
                                  retail * 1.03),2) "Revised Price"
    FROM books
    ORDER BY category, title;Note that the alias (I assume) revised Proce needs to go outside of both the decode and the round.
    John

  • Help with JSON Decoding

    Hi guys, I'm kinda a n00b to Flex, and definitely a n00b to JSON decoding, hoping you can help me out.
    I just put the very basics in this code, I want to  be able to decode the JSON from the Rotten Tomatoes link, and display it in a datagrid. I seem to be only getting the top level (I took out the datagrid colums so you can see what it populates with). I want to get the actual movie info, which is one level further down. How do I do that?
    Here's the link I'm trying to read in: http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=u9pv54jkhnhemfx8x6u8q83r& q=Jack&page_limit=1
    And here's my full code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute"
                                            creationComplete="service.send()">
              <mx:Script>
                        <![CDATA[
                                  import mx.collections.ArrayCollection;
                                  import mx.rpc.events.ResultEvent;
                                  import com.adobe.serialization.json.JSON;
                                  import mx.utils.*;
                                  private function onJSONLoad(event:ResultEvent):void
                                            var rawData:String = String(event.result);
                                            var info:Object = JSON.decode(rawData);
                                            var dp:ArrayCollection = new ArrayCollection(ArrayUtil.toArray(info));
                                            grid.dataProvider = dp;
                                  var urlString:String = "http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=u9pv54jkhnhemfx8x6u8q83r& q=Jack&page_limit=1";
                        ]]>
              </mx:Script>
              <mx:HTTPService id="service" resultFormat="text"
                                                      url= "{urlString}"
                                                      result="onJSONLoad(event)" />
              <mx:DataGrid id="grid" right="10" left="10" top="10" bottom="10">
              </mx:DataGrid>
    </mx:Application>

    Hi,
    I have modified Your code and placed it here. it is working fine.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute"
                                            creationComplete="service.send()">
              <mx:Script>
                        <![CDATA[
                                  import mx.collections.ArrayCollection;
                import mx.rpc.events.ResultEvent;
                import com.adobe.serialization.json.JSON;
                import com.adobe.serialization.json.JSONDecoder;
                import com.adobe.serialization.json.JSONTokenizer;
                import mx.utils.*;
                import mx.controls.Alert;
                private function onJSONLoad(event:ResultEvent):void
                    var rawData:String = String(event.result);
                    var info:Object = new JSONDecoder(rawData,true).getValue().movies as Object;
                    var dp:ArrayCollection = new ArrayCollection(ArrayUtil.toArray(info));
                    grid.dataProvider = dp;
                var urlString:String = "http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=u9pv5                 4jkhnhemfx8x6u8q83r&q=Jack&page_limit=1";
                        ]]>
              </mx:Script>
              <mx:HTTPService id="service" resultFormat="text"
                                                      url= "{urlString}"
                                                      result="onJSONLoad(event)" />
              <mx:DataGrid id="grid" right="10" left="10" top="10" bottom="10" >
            <mx:columns>
                <mx:DataGridColumn headerText="Title" dataField="title" />
                <mx:DataGridColumn headerText="Year" dataField="year" />
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>
    And place column name which columns do want to show. And as3corelib.swc it is a library download it for jsondecoder.
    I think it would be helpful for you. 
    Thanks
    Raghu.

  • Help with Select Decode !

    Hello all
    I dont have a idea how to write this Select. But this need to be in SQL not PL/SQL .
    I want recive answer Yes or No from two select in one query how i can do that ?
    (select decode(count(1),0,'No','Yes') from zia_all_diagnoses dgs where dgs.mse_mse_id = ZiaVMessages_EO.MSE_ID and dgs.ccn_class_codcontain_case_type = 'DV0002')
    (SELECT DECODE (COUNT (1), 0, 'No', 'Yes')    FROM zia_all_diagnoses dgs   WHERE dgs.cse_cse_id = SgrVcases_EO.CSE_ID     AND dgs.ccn_class_codcontain_case_type = 'DV0002')The result need to be
    If someone of query return yes then i need to get Yes , if both ar No then No
    Thanks
    ID.
    Edited by: 1D10T on Oct 29, 2012 8:04 AM

    Hi,
    I would do something like that :select case
    when exists (select null from zia_all_diagnoses dgs where dgs.mse_mse_id = ZiaVMessages_EO.MSE_ID and dgs.ccn_class_codcontain_case_type = 'DV0002') then 'Yes'
    when exists (SELECT null FROM zia_all_diagnoses dgs WHERE dgs.cse_cse_id = SgrVcases_EO.CSE_ID AND dgs.ccn_class_codcontain_case_type = 'DV0002') then 'Yes'
    else 'No' end chck
    from dual;

  • Help with Decode function

    Hello!!
    Can anyone please help me with the decode statement
    Table 1 Table2 Table3
    Id Id Code
    Volume Code
    For each of the codes in Table3 I need to find the corresponding Volume. Can I use decode in the select statement to this,
    Eg Code Volume
    ABC 20
    XYZ 10 etc etc.
    Thankyou all in advance.

    Your table structure is a little unclear from your post. I am assuming that what you posted was:
    Table 1
    Id
    Table2
    Id
    Code
    Table3
    Volume
    Code You can use decode if there are only a few values for table3. For example,
    SELECT table2.code,
    DECODE(table2.code,'ABC',10,'XYZ',20,'UNKNOWN') volume
    FROM table2
    or even
    SELECT code,DECODE(code,null,'NONE',
                      (SELECT volume FROM table3 where code=table2.code)) volume
    FROM table2However, the first will break, or at least be incorrect, if anyone adds a new code/volume pair, and is tedious if you have more than a few values. The second will likely be pretty slow if there are a large number of records in table3. The best solution would be to use a simple join rather than decode. Something like:
    SELECT table1.id, table2.code, table3.volume
    FROM table1, table2, table3
    WHERE table1.id = table2.id and
          table2.code = table3.code

  • HELP WITH TRYING TO DO A FIXED ASSETS REPORT IN DISCOVERER

    Hi...
    I'll try and explain this simply as I can.
    I am trying to do a Disco report to basically list the asset numbers with the cost, the opening depreciation, the YTD depreciation, Accumulated depreciation and the remaining life of the asset.
    I can get most of the data from the FABG_DEPRECIATIONS table.
    The report will be run for a specific period say for example 05-2008. The problem I have is that for some of the assets there won't have been any depreciation for the year 2008 but I still need those assets to appear on the report showing the cost, opening depreciation etc.
    But because the report is being run for a specific period say 05-2008 in this example these assets that have no depreciation for the period are not being displayed on the report.
    As there isn't a field (I couldn't find one in any of the tables)that has the opening depreciation I have used a calculation for this which is Accumulated Depreciation - YTD depreciation. This is where my problem is. For those assets that have had no depreciation in the current year being reported on it should use the accumulated depreciation for say 12-2007 as the opening depreciation for the year 2008.
    So in the example of reporting for period 05-2008, it show the opening depreciation which would be the accumulated depreciation for 12-2007 and 0 (zero) for YTD depreciation.
    That is why I have attempted without success to use a union statement. The sql is below.
    I would be very grateful for some help with this please.
    select apps.fabg_depreciations.asset_id Asset_Number
    ,apps.fabg_depreciations.ytd_deprn YTD_Deprn
    ,apps.fabg_depreciations.deprn_amount Deprn_Amount
    ,apps.fabg_depreciations.accumulated_deprn Accumulated_Deprn
    ,apps.fabg_depreciations.reval_reserve Reval_reserve
    ,apps.fabg_acct_prds.period_name Period
    ,apps.fabg_asset_bks.original_cost Original_Cost
    ,apps.fabg_asset_bks.cost Cost
    ,apps.fabg_assets.asset_category_id Category_ID
    ,Null Period_Counter
    ,Null Opening_Dep
    ,apps.fabg_asset_cats.description Description
    from apps.fabg_depreciations
    , apps.fabg_acct_prds
    , apps.fabg_asset_bks
    , apps.fabg_assets
    , apps.fabg_asset_cats
    where apps.fabg_depreciations.book_type_code= 'ASSETS CCA'
    and apps.fabg_depreciations.period_counter =apps.fabg_acct_prds.period_counter
    and apps.fabg_asset_bks.asset_id=apps.fabg_depreciations.asset_id(+)
    and apps.fabg_assets.asset_id=apps.fabg_asset_bks.asset_id
    and apps.fabg_assets.asset_category_id=fabg_asset_cats.asset_category_id
    union
    select Null Asset_Number
    ,Null YTD_Deprn
    ,Null Deprn_Amount
    ,Null Accumulated_Deprn
    ,Null Reval_reserve
    ,Null Period
    ,Null Original_Cost
    ,Null Cost
    ,Null Category_ID
    ,Null Period_Counter
    ,decode(apps.fabg_depreciations.period_counter,24096,ytd_deprn,0) Opening_Dep
    ,Null Description
    from apps.fabg_depreciations
    , apps.fabg_acct_prds
    , apps.fabg_asset_bks
    , apps.fabg_assets
    , apps.fabg_asset_cats
    where apps.fabg_depreciations.book_type_code= 'ASSETS CCA'
    and apps.fabg_depreciations.period_counter=24096
    and apps.fabg_depreciations.period_counter =apps.fabg_acct_prds.period_counter
    and apps.fabg_asset_bks.asset_id=apps.fabg_depreciations.asset_id(+)
    and apps.fabg_assets.asset_id=apps.fabg_asset_bks.asset_id
    and apps.fabg_assets.asset_category_id=fabg_asset_cats.asset_category_id

    Hi...
    I've changed the custom code and used an embedded sql instead of a union but I still don't get the required info. I think it's down to the conditions. Can someone please help? Thanks.
    This is the revised code:
    select apps.fabg_depreciations.asset_id Asset_Number
    ,apps.fabg_depreciations.ytd_deprn YTD_Deprn
    ,apps.fabg_depreciations.deprn_amount Deprn_Amount
    ,apps.fabg_depreciations.accumulated_deprn Accumulated_Deprn
    ,apps.fabg_depreciations.reval_reserve Reval_reserve
    ,apps.fabg_acct_prds.period_name Period
    ,apps.fabg_asset_bks.original_cost Original_Cost
    ,apps.fabg_asset_bks.cost Cost
    ,apps.fabg_assets.asset_category_id Category_ID
    ,OD.accumulated_deprn Opening_Dep
    ,apps.fabg_asset_cats.description Description
    from apps.fabg_depreciations
    , apps.fabg_acct_prds
    , apps.fabg_asset_bks
    , apps.fabg_assets
    , apps.fabg_asset_cats
    ,(select fabg_depreciations.asset_id, fabg_depreciations.accumulated_deprn, fabg_depreciations.period_counter from apps.fabg_depreciations) OD
    where apps.fabg_depreciations.book_type_code= 'ASSETS CCA'
    and apps.fabg_asset_bks.asset_id=apps.fabg_assets.asset_id
    and apps.fabg_assets.asset_id = OD.asset_id
    and apps.fabg_assets.asset_id=apps.fabg_depreciations.asset_id
    --and apps.fabg_acct_prds.period_counter=apps.fabg_depreciations.period_counter(+)
    and apps.fabg_assets.asset_category_id=fabg_asset_cats.asset_category_id
    and apps.fabg_depreciations.period_counter=OD.period_counter(+)
    and OD.period_counter = 24096

  • Need help with a query

    Hi,
    I need help with the following query. I want the balance (bal) with the latest exchange rate available.
    Sample table & data
    with
    FX_RATE as
    select 11 as id_date, 1 as id_curr, 47 as EXCH_rate from dual union
    select 12, 1, 48 from dual union
    select 13, 2, 54 from dual union
    select 14, 2, 55 from dual union
    select 15, 3, 56 from dual union
    select 15, 2, 49 from dual),
    TBL_NM as
    select 13 as p_date, 2 as p_curr, 200 as bal from dual union
    select 14, 2, 200 from dual union
    select 15, 2, 200 from dual union
    select 16, 2, 200 from dual union
    select 17, 2, 200 from dual union
    select 11, 5, 100 from dual
    select p_date, p_curr, bal * nvl(exch_rate,1) from TBL_NM T LEFT OUTER JOIN FX_RATE F1 on (id_curr = p_curr and F1.id_date = T.p_Date)In the above query for p_date 16 & 17 and p_curr 2 it returns just balance multiplied by exchange rate 1"default". But i want the balance to have data as per latest exchange rate which is of exchange rate 15.
    I tried this but returns error ORA-01799: a column may not be outer joined to a subquery ..
    with
    FX_RATE as
    select 11 as id_date, 1 as id_curr, 47 as EXCH_rate from dual union
    select 12, 1, 48 from dual union
    select 13, 2, 54 from dual union
    select 14, 2, 55 from dual union
    select 15, 3, 56 from dual union
    select 15, 2, 49 from dual),
    TBL_NM as
    select 13 as p_date, 2 as p_curr, 200 as bal from dual union
    select 14, 2, 200 from dual union
    select 15, 2, 200 from dual union
    select 16, 2, 200 from dual union
    select 17, 2, 200 from dual union
    select 11, 5, 100 from dual
    select p_date, p_curr, bal * nvl(exch_rate,1) from TBL_NM T LEFT OUTER JOIN FX_RATE F1
    on (id_curr = p_curr and F1.id_date = (select max(F2.id_date) from FX_RATE F2 where F2.id_curr = T.p_curr and F2.id_Date <=  T.p_date))Please advice on how i can achieve this ..

    The entire query wud be like this .. I've to incorporate in here
    CREATE MATERIALIZED VIEW MV_DUMMY
    BUILD IMMEDIATE
    REFRESH FORCE ON DEMAND
    AS
        SELECT T.ID_TSACTION_RELEASED                                                                                
        BAL.ID_CONTRACT_BALANCE                                                                                                                                                                                                                                                                           AS ID_CONTRACT_BALANCE,   
        T.N_REFERENCE_NUMBER                                                                                          
        T.INSTRUMENT_N_REFERENCE                                                                                      
        T.ITEM_NUMBER                                                                                                   
        T.EXTERNAL_SYSTEM_ID                                                                                            
        T.SEQUENCE_NUMBER                                                                                               
        T.ID_RELEASED_DATE                                                                                              
       ROUND(BAL.LC_AVAILABLE_BALANCE * NVL(FX1.EXCHANGE_RATE,1) / NVL(FX2.EXCHANGE_RATE,1) , 4)                           
        BAL.LIABILITY_BALANCE                                                                                              
        BAL.LIABILITY_BALANCE * NVL(FX3.EXCHANGE_RATE,1)                                                                   
        BAL.LIABILITY_CHANGE_USD                                                                                           
        BAL.MEMO_LIABILITY_BALANCE                                                                                         
        BAL.MEMO_LIABILITY_BALANCE * NVL(FX3.EXCHANGE_RATE,1)                                                              
        BAL.MEMO_LIABILITY_CHANGE_USD                                                                                      
        BAL.ORIGINAL_FACE_AMOUNT                                                                                           
        decode(T.TENOR_CODE,'Time','T','Sight','S','Split Sight Time','SST','Split Multiple Time','SMT',T.TENOR_CODE)
        CASE
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
          THEN T.ID_LIABILITY_CIF
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
          THEN T.Id_Beneficiary
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
          THEN T.ID_Applicant
        END PRIMARY_CUSTOMER_ID,
        CASE
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
          THEN plbcif.EXTERNAL_SYSTEM_ID
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
          THEN PBCIF.EXTERNAL_SYSTEM_ID
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
          THEN pappcif.EXTERNAL_SYSTEM_ID
        END PRIMARY_CUSTOMER_EXT_SYS_ID,
        CASE
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
          THEN plbcif.CIF_NAME
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
          THEN PBCIF.CIF_NAME
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
          THEN pappcif.CIF_NAME
        END PRIMARY_CUSTOMER_NAME,
        CASE
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
          THEN plbbac.BAC
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
          THEN pbbac.BAC
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
          THEN pappbac.BAC
        END PRIMARY_CUST_BAC_CODE,
        CASE
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
          THEN nvl(plbmg.MARKET,'NOT APPLICABLE')
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
          THEN nvl(pbmg.MARKET,'NOT APPLICABLE')
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
          THEN nvl(pappmg.MARKET,'NOT APPLICABLE')
        END PRIMARY_CUST_MARKET,
        CASE
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ILC','IB','AIR','STG','NLC','NP')
          THEN nvl(plbmg.SUB_MARKET,'NOT APPLICABLE')
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('ELC','EB','XLC','XP','EC','LN','SCF-AR')
          THEN nvl(pbmg.SUB_MARKET,'NOT APPLICABLE')
          WHEN GTSPROD.PRODUCT_CATEGORY IN ('TLC','IC','OA','SCF-AP')
          THEN nvl(pappmg.SUB_MARKET,'NOT APPLICABLE')
        END PRIMARY_CUST_SUB_MARKET
      FROM F_TSACTION_RELEASED T
      LEFT OUTER JOIN D_BAC_CODE BAC
      ON (T.BAC_CODE_LIABILITY = BAC.BAC_CODE)
      LEFT OUTER JOIN REF_BAC_SORT_CODE REF_BAC
      ON (T.BAC_CODE_LIABILITY = REF_BAC.BAC)
      LEFT OUTER JOIN F_CONTRACT_BALANCE BAL
      ON (T.ID_TSACTION_RELEASED = BAL.ID_TSACTION_RELEASED)
      LEFT OUTER JOIN D_MARKET_SEGMENT MG
      ON (T.ID_MARKET_SEGMENT = MG.ID_MARKET_SEGMENT)
      LEFT OUTER JOIN D_DATE DT
      ON (DT.ID_DATE = T.ID_RELEASED_DATE)
      LEFT OUTER JOIN D_DATE DB
      ON (DB.ID_DATE = BAL.ID_RELEASED_DATE)
      LEFT OUTER JOIN D_PROCESSING_UNIT PU
      ON (PU.ID_PROCESSING_UNIT = T.ID_PROCESSING_UNIT)
      LEFT OUTER JOIN D_BIR_PRODUCT BIRPROD
      ON (BIRPROD.ID_BIR_PRODUCT=T.ID_BIR_PRODUCT)
      LEFT OUTER JOIN D_GTS_PRODUCT_TYPE GTSPROD
      ON (GTSPROD.ID_GTS_PRODUCT_TYPE= T.ID_GTS_PRODUCT_TYPE)
      LEFT OUTER JOIN D_GTS_TSACTION_TYPE GTST
      ON (GTST.ID_GTS_TSACTION_TYPE = T.ID_GTS_TSACTION_TYPE)
      LEFT OUTER JOIN D_CURRENCY CCYT
      ON (CCYT.ID_CURRENCY = T.ID_TSACTION_CURRENCY)
      LEFT OUTER JOIN d_cif lcif
      ON (lcif.id_cif = T.id_liability_cif)
      LEFT OUTER JOIN d_cif lbcif
      ON (lbcif.id_cif = bal.id_liability_cif)
      LEFT OUTER JOIN d_cif bcif
      ON (bcif.id_cif = T.id_BENEFICIARY)
      LEFT OUTER JOIN d_cif icif
      ON (icif.id_cif = T.id_ISSUING_BANK)
      LEFT OUTER JOIN d_cif acif
      ON (acif.id_cif = T.id_ADVISING_BANK)
      LEFT OUTER JOIN d_cif appcif
      ON (appcif.id_cif = T.id_applicant)
      LEFT OUTER JOIN d_state astate
      ON (astate.id_state = acif.id_state)
      LEFT OUTER JOIN d_state bstate
      ON (bstate.id_state = bcif.id_state)
      LEFT OUTER JOIN d_state lstate
      ON (lstate.id_state = lcif.id_state)
      LEFT OUTER JOIN d_state lbstate
      ON (lbstate.id_state = lbcif.id_state)
      LEFT OUTER JOIN d_state istate
      ON (istate.id_state = icif.id_state)
      LEFT OUTER JOIN d_state appstate
      ON (appstate.id_state = appcif.id_state)
      LEFT OUTER JOIN D_TSACTION_SOURCE TSrc
      ON (T.ID_TSACTION_SOURCE = TSrc.ID_TSACTION_SOURCE)
      LEFT OUTER JOIN D_COUNTRY LCTRY
      ON (LCTRY.ID_COUNTRY = lcif.ID_COUNTRY)
      LEFT OUTER JOIN D_COUNTRY LBCTRY
      ON (LBCTRY.ID_COUNTRY = lbcif.ID_COUNTRY)
      LEFT OUTER JOIN D_COUNTRY BCTRY
      ON (BCTRY.ID_COUNTRY = bcif.ID_COUNTRY)
      LEFT OUTER JOIN D_COUNTRY ICTRY
      ON (ICTRY.ID_COUNTRY = icif.ID_COUNTRY)
      LEFT OUTER JOIN D_COUNTRY ACTRY
      ON (ACTRY.ID_COUNTRY = acif.ID_COUNTRY)
      LEFT OUTER JOIN D_COUNTRY APPCTRY
      ON (APPCTRY.ID_COUNTRY = appcif.ID_COUNTRY)
      LEFT OUTER JOIN D_COUNTRY PCTRY
      ON (PCTRY.ID_COUNTRY = T.ID_PRESENTER_COUNTRY)
      LEFT OUTER JOIN D_LOCATION LOC
      ON (LOC.ID_LOCATION = T.ID_PROCESSING_LOCATION)
      LEFT OUTER JOIN D_CURRENCY BCCYT
      ON (BCCYT.ID_CURRENCY = BAL.ID_LIABILITY_CURRENCY)
      LEFT OUTER JOIN D_CURRENCY BALCYT
      ON (BALCYT.ID_CURRENCY = BAL.ID_BALANCE_CURRENCY)
      LEFT OUTER JOIN d_liability_type li
      ON (li.id_liability_type = BAL.id_liability_type)
      LEFT OUTER JOIN d_cif plbcif
      ON (plbcif.id_cif = T.id_liability_cif)
      LEFT OUTER JOIN REF_BAC_SORT_CODE plbbac
      ON (plbcif.bac_code=plbbac.bac)
      LEFT OUTER JOIN D_MARKET_SEGMENT plbmg
      ON (plbbac.SORT_CODE=plbmg.MARKET_SEGMENT)
      LEFT OUTER JOIN d_cif pbcif
      ON (pbcif.id_cif = T.id_BENEFICIARY)
      LEFT OUTER JOIN REF_BAC_SORT_CODE pbbac
      ON (pbcif.bac_code=pbbac.bac)
      LEFT OUTER JOIN D_MARKET_SEGMENT pbmg
      ON (pbbac.SORT_CODE=pbmg.MARKET_SEGMENT)
      LEFT OUTER JOIN d_cif pappcif
      ON (pappcif.id_cif = T.id_applicant)
      LEFT OUTER JOIN REF_BAC_SORT_CODE pappbac
      ON (pappcif.bac_code=pappbac.bac)
      LEFT OUTER JOIN D_MARKET_SEGMENT pappmg
      ON (pappbac.SORT_CODE=pappmg.MARKET_SEGMENT)
      LEFT OUTER JOIN D_CURRENCY LOCALCYT
      ON (LOCALCYT.alpha_code = PU.local_ccy)
      LEFT OUTER JOIN D_BRANCH Branch              
      ON (T.ID_BRANCH  = Branch.ID_BRANCH )
      LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX1
      ON (BAL.ID_BALANCE_CURRENCY = FX1.ID_CURRENCY and FX1.ID_DATE = (select max(FX11.ID_DATE) from F_USD_FX_RATE_HISTORY FX11 where BAL.ID_BALANCE_CURRENCY = FX11.ID_CURRENCY and FX11.ID_DATE <= BAL.id_released_date))
      LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX2
      ON (LOCALCYT.ID_CURRENCY = FX2.ID_CURRENCY and FX2.ID_DATE = (select max(FX22.ID_DATE) from F_USD_FX_RATE_HISTORY FX22 where LOCALCYT.ID_CURRENCY = FX22.ID_CURRENCY and FX22.ID_DATE <= BAL.id_released_date))
      LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX3
      ON (BAL.ID_LIABILITY_CURRENCY = FX3.ID_CURRENCY and FX3.ID_DATE = (select max(FX33.ID_DATE) from F_USD_FX_RATE_HISTORY FX33 where BAL.ID_LIABILITY_CURRENCY = FX33.ID_CURRENCY and FX33.ID_DATE <= BAL.id_released_date))Note the lines
    ROUND(BAL.MN_AVAILABLE_BALANCE * NVL(FX1.EXCHANGE_RATE,1) / NVL(FX2.EXCHANGE_RATE,1) , 4)                           
    BAL.LIABILITY_BALANCE * NVL(FX3.EXCHANGE_RATE,1)                                                                   
    BAL.MEMO_LIABILITY_BALANCE * NVL(FX3.EXCHANGE_RATE,1)                 
    And
    LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX1
      ON (BAL.ID_BALANCE_CURRENCY = FX1.ID_CURRENCY and FX1.ID_DATE = (select max(FX11.ID_DATE) from F_USD_FX_RATE_HISTORY FX11 where BAL.ID_BALANCE_CURRENCY = FX11.ID_CURRENCY and FX11.ID_DATE <= BAL.id_released_date))
      LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX2
      ON (LOCAMNYT.ID_CURRENCY = FX2.ID_CURRENCY and FX2.ID_DATE = (select max(FX22.ID_DATE) from F_USD_FX_RATE_HISTORY FX22 where LOCAMNYT.ID_CURRENCY = FX22.ID_CURRENCY and FX22.ID_DATE <= BAL.id_released_date))
      LEFT OUTER JOIN F_USD_FX_RATE_HISTORY FX3
      ON (BAL.ID_LIABILITY_CURRENCY = FX3.ID_CURRENCY and FX3.ID_DATE = (select max(FX33.ID_DATE) from F_USD_FX_RATE_HISTORY FX33 where BAL.ID_LIABILITY_CURRENCY = FX33.ID_CURRENCY and FX33.ID_DATE <= BAL.id_released_date))Thsi is where I need to incorporate the change

  • Need help with deciding digital options... creative ddts-100, ddts-610, x-fi i/o cons

    I think i have narrowed down my options for upgrading my computer audio... except i am not sure which way to go and would like some help or ti
    ps.
    ... thanks.
    first off i mainly game and listen to music on the pc or listen to the music while gaming... i currently have the logitech z5300e speaker system, creative labs x-fi fatalty pro gamer sound card... i wanted to purchase a receiver to go digital except thats a bit too much for me right now, if i was to get a receiver it would be for my home theater. so i looked around and came up with a couple alternati'ves, except i am not sure if these options will work with what i have now...
    ?st option, i could go along with getting a creative labs inspire digital 5500 speaker system because that sytem comes with a decoder box that creative labs no longer makes... this decoder box has 2 optical in, coax in, also has a adaoter that connects the speakers to the decoder box as well... runs around 200.00 dollars?2nd option, i found on creatives website a new decoder called the dts-60 except this option would require a receiver because this newer model does not come with the speaker adapter as the dts-00 does... but since i am going to upgrade my home theater receiver i would have that one to use with the coax connections. this option runs 00.00 dollars?3rd option, i? found on creatives website a x-fi i/o console so far from what i read it works with my sound card ... i am still not sure if i can just connect the speaker cable to the console but this would run 80.00?4th option , on there website there is also, a dribe bay x-fi i/o upgrade. not sure if it will work with my soundcard but i was thinking it may be an option to use cause the card i have has built in decoders i think..
    ??what would you guys do ?

    dont buy creative ...no support from them

  • Need help with Go Pro Hero 3 and Premiere Pro CS6

    Hello,
    I recently acquired PP CS6. I put my clip (30 seconds long) and I go to preview while editing, for the first 1.5 seconds it is fine but then it is very choppy. The audio is fine but the video does not play smoothly. When I save and process the video it is fine. It is frustrating to try to edit video this way. I'm sure I'm missing a step when creating the project but I haven't used Premiere Pro since CS6. This is only happening with Go Pro Hero 3 videos, any of my other cameras are fine. Any ideas? Thanks

    There's a lot of confusion over how video encoding affects subsequent editing performance - a higher data rate has no direct relation to how much effort is required to decode and play the footage, in fact a higher data rate often makes playback easier - which is why transcoding to AVI can help with playback even though the files can be hundreds of times larger. Data rates with the same codec depend on the frame contents and recording quality, but for playback and editing what matters is the GOP (group-of-pictures) structure and the complexity of the encoding algorithm. Provided your disks are fast enough the data rate is immaterial to Premiere.
    With long-GOP files (as typically created by consumer DSLRs and helmet cams) we have keyframes (I-frames) with a complete set of pixel data, then a series of intervening P- and B-frames which only store the difference between 'now' and 'one frame before' or 'one frame after'. Unless you're on an I-frame you have to calculate the chain of differences from the nearest I-frame, and when editing or applying an effect we must  re-calculate the entire GOP, so Premiere has to hold a lot of data in the buffer. Remember all timelines in Premiere are internally transcoded to 32-bit floating point, so it's more work to 'play' the footage in the monitors than would be done by a simple playback-only application such as VLC, or in some other brands of NLE that only work in the footage's color space. Premiere's hardware acceleration (MPE) only kicks in once the buffer has been ingested, all the decoding of the original H.264 frames happens in your CPU.
    With digital cinema cameras and some hacked DSLRs, we record "all-I" footage - so there's no GOP overhead and playback/editing is massively smoother. I can scrub all-I footage from a hacked 7D no problem on my relatively-ancient spare laptop, but the  long-GOP files from a factory 7D struggle to play at all. Our all-I 7D footage can hit 300MBit/s compared to 35 for long-GOP. Helmet cams such as the GoPro do all they possibly can to squeeze data onto their storage cards, which means they have long-GOP codecs that have some of the most complicated compression algorithms out there. The Hero3's implementation of H.264 uses the Ambarella chip, whose files are very small but an utter nightmare to decode - hence far more of a demand on your CPU than an equivalent clip from a DSLR.
    Jim Simon wrote:
    Might be the 35 Mbps that is causing the choppy playback.
    It shouldn't, assuming sufficient hardware.  My GH2 clips often get up to over 90 Mb/s and play just fine on an older i7 920.

  • I need help with adobe iv reader.

    iam trying to pin a website using ie.it says the reader cannot read the website,i am not computer saavy so i donot know how to fix this issue, pls help,tyvm.

    i am trying to pin a website in internet explorer to my task bar,i get a 
    message that adobe v1 could not decode the website, i am not computer saavy
    so i  don't know what that means,plus this is a new computer 4 me.plus it
    worked fine  a few days ago. tyvm 4 ur help.
    regards,
    ray nist
    In a message dated 6/11/2013 9:27:11 P.M. Eastern Daylight Time, 
    [email protected] writes:
    Re: i  need help with adobe iv reader.
    created by Pat Willener (http://forums.adobe.com/people/pwillener)  in 
    Adobe Reader - View the full  discussion
    (http://forums.adobe.com/message/5400013#5400013)

  • Need help with Pivoting rows to columns

    Hi,
    I need help with pivoting rows to columns. I know there are other posts regarding this, but my requirement is more complex and harder. So, please give me a solution for this.
    There are two tables say Table 1 and Table 2.
    Table1
    name address email identifier
    x e g 1
    f s d 2
    h e n 3
    k l b 4
    Table2
    identifier TRno zno bzid
    1 T11 z11 b11
    1 T12 z12 b12
    1 T13 z13 b13
    2 T21 z21 b21
    2 T22 z22 b22
    As you can see the identifier is the column that we use to map the two tables. The output should be like below
    output
    name address email identifier TRno1 zno1 bzid1 TRno2 zno2 bzid2 TRno3 zno3 bzid3
    x e g 1 T11 z11 b11 T12 z12 b12 T13 z13 b13
    f s d 2 T21 z21 b21 t22 z22 b22
    Also we do not know exactly how many TRno's, zno's, etc each value in the identifier will have. There may be only 1 TRNO, zno and bzid, or there may be four.
    All the values must be in separate columns, and not be just comma delimitted. There are also other conditions that i have to add to restrict the data.
    So, can you please tell me what is should use to get the data in the required format? We are using Oracle 10g. Please let me know if u need any more information

    Something like this ?
    SCOTT@orcl> ed
    Wrote file afiedt.buf
      1  select a.name,
      2  a.address,
      3  a.email,
      4  b.* from (
      5  select distinct identifier
      6  ,max(trno1) trno1
      7  ,max(zno1) zno1
      8  ,max(bzid1) bzid1
      9  ,max(trno2) trno2
    10  ,max(zno2) zno2
    11  ,max(bzid2) bzid2
    12  ,max(trno3) trno3
    13  ,max(zno3) zno3
    14  ,max(bzid3) bzid3
    15  ,max(trno4) trno4
    16  ,max(zno4) zno4
    17  ,max(bzid4) bzid4
    18  from (select identifier
    19  ,decode(rn,1,trno,null) trno1
    20  ,decode(rn,1,zno,null) zno1
    21  ,decode(rn,1,bzid,null) bzid1
    22  ,decode(rn,2,trno,null) trno2
    23  ,decode(rn,2,zno,null) zno2
    24  ,decode(rn,2,bzid,null) bzid2
    25  ,decode(rn,3,trno,null) trno3
    26  ,decode(rn,3,zno,null) zno3
    27  ,decode(rn,3,bzid,null) bzid3
    28  ,decode(rn,4,trno,null) trno4
    29  ,decode(rn,4,zno,null) zno4
    30  ,decode(rn,4,bzid,null) bzid4
    31  from (select identifier,
    32  trno,bzid,zno,
    33  dense_rank() over(partition by identifier order by trno,rownum) rn
    34  from table2)
    35  order by identifier)
    36  group by identifier) b,table1 a
    37* where a.identifier=b.identifier
    SCOTT@orcl> /
    NAME       ADDRESS    EMAIL      IDENTIFIER TRNO1      ZNO1       BZID1      TRNO2      ZNO2       BZID2      TRNO3      ZNO3       BZID3      TRNO4      ZNO4       BZID4
    x          e          g          1          T11        z11        b11        T12        z12        b12        T13        z13        b13
    f          s          d          2          T21        z21        b21        T22        z22        b22
    SCOTT@orcl> select * from table1;
    NAME       ADDRESS    EMAIL      IDENTIFIER
    x          e          g          1
    f          s          d          2
    h          e          n          3
    k          l          b          4
    SCOTT@orcl> select * from table2;
    IDENTIFIER TRNO       ZNO        BZID
    1          T11        z11        b11
    1          T12        z12        b12
    1          T13        z13        b13
    2          T21        z21        b21
    2          T22        z22        b22
    SCOTT@orcl>Regards
    Girish Sharma

  • Please help with SQL amount calulation

    -- Results
    with t as ( 
    select 'P11877' Mstr_Program,   1 Year_of_study, 'BUSI1490' program_module,  20 no_of_stud,    1 rank,   30 program_credits,  30 cumm_credits   from dual union all
    select 'P11877',                1,              'COMP1365',                 20,               2,        30,                  60               from dual union all
    select 'P11877',                1,              'BUSI1375',                 20,               3,        30,                  90               from dual union all
    select 'P11877',                1,              'COMP1363',                 20,               4,        30,                  120              from dual union all
    select 'P11877',                2,              'MARK1174',                 8,                1,        30,                  30               from dual union all
    select 'P11877',                2,              'FINA1068',                 8,                2,        15,                  45               from dual union all
    select 'P11877',                2,              'INDU1062',                 8,                3,        30,                  75               from dual union all
    select 'P11877',                2,              'BUSI1329',                 8,                4,        15,                  90               from dual union all
    select 'P11877',                2,              'MARK1138',                 8,                5,        30,                  120              from dual)
    select * from t;-- Each MSTR_PROGRAM can have 1 or many program_module
    -- MSTR_PROGRAM's can run for 1 or 2 years (case above is two years) so some modules run in year 1 and some in year 2
    -- NO_OF_STUD is the number of students on the module
    -- RANK basically ranks the modules by the number of students on them grouped by program and year
    -- e.g.row_number() OVER (PARTITION BY Mstr_Program, Year_of_study) ORDER BY COUNT(STUDENT_ID) DESC) rank
    -- PROGRAM_CREDITS: each module has a fixed number of credits
    -- CUMM_CREDITS: Increments the credit count of modules
    -- SUM(program_credits * 10) OVER (PARTITION BY Mstr_Program, Year_of_study
    -- ORDER BY count(STUDENT_ID) desc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) cumm_credits
    -- I want to trim of any modules once the CUM_CREDITS hits 120. As seen above. I achieve this by wrapping the main query is another SELECT then LIMIT
    -- that WHERE cum_credit <=120.
    -- But what I need is:
    -- In some cases the the cumm_credit maybe on lets say 90credits then the next module is worth 40 credits. This next module will not show as it
    -- will be greater than 120 credits, so i need to pro-rata it:
    -- So if credit_count > 120, then the last module is counted pro-rata as follows: 1- ((credit count - 120) / credits from last module
    -- Can anyone help with how I can incorporate this into my current code: The SELECT portion of the Original SQL is below: I simplified column names
    -- e.t.c in the above so they wont be the same
    SELECT * FROM (
         SELECT
               ,SR_PROGRAM Mstr_Program
               ,DECODE (SORLCUR_YEAR, 1, 1,
                                      2, 2,
                                      3, 3,
                                      4, 3, SR_YEAR) year_of_study
               ,SCT_SUBJ_CODE||SCT_CRSE_NUMB program_module
               ,COUNT(student_ID)                    no_of_stud
               ,row_number() OVER (PARTITION BY sr_program,
                                            DECODE (sr_year, 1, 1,
                                                                  2, 2,
                                                                  3, 3,
                                                                  4, 3, SR_YEAR) ORDER BY COUNT(student_id) DESC, scbcrse_title asc) rank
               ,(SCT_CREDIT_HRS * 10) program_credits
               ,SUM(SCT_CREDIT_HRS * 10) OVER (PARTITION BY sr_program, DECODE (sorlcur_year, 1, 1,
                                                                                                       2, 2,
                                                                                                       3, 3,
                                                                                                       4, 3, SR_YEAR)
                                                    ORDER BY count(student_id) desc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) cumm_credits
    WHERE cumm_credit <=120
    ORDER BY Mstr_Program, YEAR_OF_STUDY, RANK asc;

    Maybe
    SELECT Mstr_Program,year_of_study,program_module,no_of_stud,rank,program_credits old_program_credits,cumm_credits old_cumm_credits,
           case when cumm_credits > 120
                then program_credits - cumm_credits + 120
                else program_credits
           end new_program_credits,
           case when cumm_credits > 120
                then 120
                else cumm_credits
           end new_cumm_credits
      FROM (SELECT SR_PROGRAM Mstr_Program,
                   DECODE(SORLCUR_YEAR,1,1,2,2,3,3,4,3,SR_YEAR) year_of_study,
                   SCT_SUBJ_CODE||SCT_CRSE_NUMB program_module,
                   COUNT(student_ID) no_of_stud,
                   row_number() OVER (PARTITION BY sr_program,DECODE(sr_year,1,1,2,2,3,3,4,3,SR_YEAR)
                                          ORDER BY COUNT(student_id) DESC,scbcrse_title) rank,
                   10 * SCT_CREDIT_HRS program_credits,
                   10 * SUM(SCT_CREDIT_HRS) OVER (PARTITION BY sr_program,DECODE(sorlcur_year,1,1,2,2,3,3,4,3,SR_YEAR)
                                                      ORDER BY count(student_id) desc
                                                  ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) cumm_credits
    WHERE 0 <= case when cumm_credits > 120
                     then program_credits - cumm_credits + 120
                     else program_credits
                end
    ORDER BY Mstr_Program,YEAR_OF_STUDY,RANKRegards
    Etbin
    Edited by: Etbin on 16.12.2011 8:50
    with
    t as   /* simulating the result achieved */
    (select 'P11877' Mstr_Program,1 Year_of_study, 'BUSI1490' program_module,20 no_of_stud,1 rank,30 program_credits,30 cumm_credits from dual union all
    select 'P11877',             1,               'COMP1365',               20,           2,     40,                70              from dual union all
    select 'P11877',             1,               'BUSI1375',               20,           3,     30,                100             from dual union all
    select 'P11877',             1,               'COMP1363',               20,           4,     40,                140             from dual union all
    select 'P11877',             2,               'MARK1174',               8,            1,     30,                30              from dual union all
    select 'P11877',             2,               'FINA1068',               8,            2,     50,                80              from dual union all
    select 'P11877',             2,               'INDU1062',               8,            3,     30,                110             from dual union all
    select 'P11877',             2,               'BUSI1329',               8,            4,     50,                160             from dual union all
    select 'P11877',             2,               'MARK1138',               8,            5,     30,                190             from dual
    select Mstr_Program,Year_of_study,program_module,no_of_stud,rank,program_credits old_credits,cumm_credits old_cumm,
           case when cumm_credits > 120
                then program_credits - cumm_credits + 120
                else program_credits
           end new_program_credits,
           case when cumm_credits > 120
                then 120
                else cumm_credits
           end new_cumm_credits
      from t
    where 0 <= case when cumm_credits > 120
                     then program_credits - cumm_credits + 120
                     else program_credits
                end

  • Need help with raw fine tuning version

    I am a new user of the aperture 2. I just activated my copy of aperture by the trial key provided by apple.
    Everything looked nice except when I imported some raw images of Fujifilm S5PRO, the raw decoder available are only 1.0 and 1.1. There are no option for 2.0. Also the recovery function under exposure is disabled.
    Need help with this, how could I solve and get back to a 2.0 decoder?
    Aperture Version is 2.01
    MAC OSX 1.5.2

    Hi KelseyyBevann,
    Welcome to the Support Communities!
    Is this the update that you tried to download?
    Digital Camera RAW Compatibility Update 4.06
    http://support.apple.com/kb/DL1656
    What version of the operating system do you have?
    When you attach your camera do you see it in Finder?
    If so, you can import the photos into iPhoto this way:
    iPhoto '11: Import photos from your hard disk or other computers
    http://support.apple.com/kb/PH2357
    Judy

  • Help with interpreting explain plan (dbms_xplan) output

    Hi all,
    I'm trying to get to grips with reading and interpreting the explain plan or dbms_xplan output, and so I hope someone can help with the output below.
    So, with the explain shown below, does it mean that...
    a) it starts with step 8 and sends all rows to the nested loop in step 5
    b) it only sends (or thinks it sends) 1 row to step 5 from step 8
    c) For each row supplied from step 5, there will be an index lookup at step 8 to access the table at step 6
    d) Step 8 only gets (or think it gets) 1 row
    If it does mean that only 1 row is expected by the optimizer, and yet the full table scan should return 150,000 records, and the table has up to date statistiucs, what else would cause the cardinality to be so far off?
    If it doesn't mean it will return 1 row then what does it mean ?
    | Id  | Operation                           | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                    |                                |       |       |   945 (100)|          |
    |   1 |  SORT GROUP BY                      |                                |     1 |   283 |   945   (3)| 00:00:05 |
    |*  2 |   FILTER                            |                                |       |       |            |          |
    |   3 |    NESTED LOOPS                     |                                |       |       |            |          |
    |   4 |     NESTED LOOPS                    |                                |     1 |   283 |   944   (3)| 00:00:05 |
    |   5 |      NESTED LOOPS                   |                                |     1 |   108 |   929   (3)| 00:00:05 |
    |*  6 |       MAT_VIEW ACCESS FULL          | DEMOGRAPHICS_MV                |     1 |    97 |   927   (3)| 00:00:05 |
    |*  7 |       MAT_VIEW ACCESS BY INDEX ROWID| NAMES_MV                       |     1 |    11 |     2   (0)| 00:00:01 |
    |*  8 |        INDEX RANGE SCAN             | ORG_MV_IDX1                    |     1 |       |     1   (0)| 00:00:01 |
    |*  9 |      INDEX RANGE SCAN               | PAY_IDX8                       |   252 |       |     4   (0)| 00:00:01 |
    |* 10 |     TABLE ACCESS BY INDEX ROWID     | PAY_ALL                        |     1 |   175 |    15   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
          8 - access("ORG_MV"."ORG_ID"="DEMO_MV"."ORG_ID")Many thanks for your help.

    Thank you Hemant and rp0428,
    I read through that white paper which was really useful.
    I ran query using GATHER_PLAN_STATISTICS and go tthe Estimate and Actual rows - wow - it is a long way out!!
    | Id  | Operation                           | Name                           | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |   0 | SELECT STATEMENT                    |                                |      1 |        |       |   945 (100)|          |      0 |00:18:11.39 |    2552K|    361K|       |       |          |
    |   1 |  SORT GROUP BY                      |                                |      1 |      1 |   283 |   945   (3)| 00:00:05 |      0 |00:18:11.39 |    2552K|    361K|  1024 |  1024 |          |
    |*  2 |   FILTER                            |                                |      1 |        |       |            |          |      0 |00:18:11.39 |    2552K|    361K|       |       |          |
    |   3 |    NESTED LOOPS                     |                                |      1 |        |       |            |          |      0 |00:18:11.39 |    2552K|    361K|       |       |          |
    |   4 |     NESTED LOOPS                    |                                |      1 |      1 |   283 |   944   (3)| 00:00:05 |     44M|00:04:59.03 |     598K|  63442 |       |       |          |
    |   5 |      NESTED LOOPS                   |                                |      1 |      1 |   108 |   929   (3)| 00:00:05 |    109K|00:00:01.73 |    7807 |      7 |       |       |          |
    |*  6 |       MAT_VIEW ACCESS FULL          | DEMOGRAPHICS_MV                |      1 |      1 |    97 |   927   (3)| 00:00:05 |    126K|00:00:00.26 |    5417 |      1 |       |       |          |
    |*  7 |       MAT_VIEW ACCESS BY INDEX ROWID| NAMES_MV                       |    126K|      1 |    11 |     2   (0)| 00:00:01 |    109K|00:00:01.27 |    2390 |      6 |       |       |          |
    |*  8 |        INDEX RANGE SCAN             | ORG_MV_IDX1                    |    126K|      1 |       |     1   (0)| 00:00:01 |    126K|00:00:00.69 |    2023 |      6 |       |       |          |
    |*  9 |      INDEX RANGE SCAN               | PAY_IDX8                       |    109K|    252 |       |     4   (0)| 00:00:01 |     44M|00:04:03.07 |     590K|  63435 |       |       |          |
    |* 10 |     TABLE ACCESS BY INDEX ROWID     | PAY_ALL                        |     44M|      1 |   175 |    15   (0)| 00:00:01 |      0 |00:13:09.85 |    1954K|    297K|       |       |          |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------When I unravel the WHERE clause and remove the decode(nvl statements (which only evaluate the passed in parameters and provide default values where they are NULL) I get a much better plan and values
    | Id  | Operation                        | Name                           | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |   0 | SELECT STATEMENT                 |                                |      1 |        |       |   157K(100)|          |      0 |00:00:43.10 |     343K|  45190 |       |       |          |
    |   1 |  SORT GROUP BY                   |                                |      1 |      1 |   283 |   157K  (1)| 00:13:47 |      0 |00:00:43.10 |     343K|  45190 |  1024 |  1024 |          |
    |   2 |   NESTED LOOPS                   |                                |      1 |        |       |            |          |      0 |00:00:43.10 |     343K|  45190 |       |       |          |
    |   3 |    NESTED LOOPS                  |                                |      1 |      1 |   283 |   157K  (1)| 00:13:47 |      0 |00:00:43.10 |     343K|  45190 |       |       |          |
    |*  4 |     HASH JOIN                    |                                |      1 |      1 |   272 |   157K  (1)| 00:13:47 |      0 |00:00:43.10 |     343K|  45190 |   720K|   720K|  171K (0)|
    |*  5 |      TABLE ACCESS BY INDEX ROWID | PAY_ALL                        |      1 |      2 |   350 |   156K  (1)| 00:13:43 |      0 |00:00:43.10 |     343K|  45190 |       |       |          |
    |*  6 |       INDEX RANGE SCAN           | PAY_IDX7                       |      1 |   3596K|       | 15565   (1)| 00:01:22 |   7251K|00:00:50.88 |   45190 |  45190 |       |       |          |
    |*  7 |      MAT_VIEW ACCESS FULL        | DEMOGRAPHICS_MV                |      0 |    126K|    11M|   919   (2)| 00:00:05 |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |*  8 |     INDEX RANGE SCAN             | ORG_MV_IDX1                    |      0 |      1 |       |     1   (0)| 00:00:01 |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    |*  9 |    MAT_VIEW ACCESS BY INDEX ROWID| NAMES_MV                       |      0 |      1 |    11 |     2   (0)| 00:00:01 |      0 |00:00:00.01 |       0 |      0 |       |       |          |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Even though the result set is zero, the time to establish this came down from 35 minutes to 30 seconds and the plan has changed and is using a different index now!
    Thanks for your help!

Maybe you are looking for