Case statement insert not working

This cursor is retrieving data for each pidm
SPRIDEN_PIDM     ACTIVITY1     ACTIVITY2     ACTIVITY3     ACTIVITY4     ACTIVITY5     ACTIVITY6
2287953                        RA      RC      RF     RJ       RN      RU
CURSOR activities_cursor
      IS
         SELECT spriden_pidm,
                REGEXP_SUBSTR (szcasup_activities,
                               '[[:alpha:]]+',
                               1,
                               1
                              ) activity1,
                REGEXP_SUBSTR (szcasup_activities,
                               '[[:alpha:]]+',
                               1,
                               2
                              ) activity2,
                REGEXP_SUBSTR (szcasup_activities,
                               '[[:alpha:]]+',
                               1,
                               3
                              ) activity3,
                REGEXP_SUBSTR (szcasup_activities,
                               '[[:alpha:]]+',
                               1,
                               4
                              ) activity4,
                REGEXP_SUBSTR (szcasup_activities,
                               '[[:alpha:]]+',
                               1,
                               5
                              ) activity5,
                REGEXP_SUBSTR (szcasup_activities,
                               '[[:alpha:]]+',
                               1,
                               6
                              ) activity6              
           FROM saturn_midd.szcasup, saturn.spriden
          WHERE szcasup_common_appl_id = spriden_id
            AND spriden_ntyp_code = 'CAPP';Then I fetched the results in variadles
FETCH activities_cursor
          INTO v_pidm, v_activity1, v_activity2, v_activity3, v_activity4,
               v_activity5,v_activity6;
Created a loop with a case statement
LOOP
         FETCH activities_cursor
          INTO v_pidm, v_activity1, v_activity2, v_activity3, v_activity4,
               v_activity5,v_activity6;
         EXIT WHEN activities_cursor%NOTFOUND;
         IF activities_cursor%FOUND
         THEN
            CASE
               WHEN (v_activity1 IS NOT NULL)
               THEN
                  INSERT INTO saturn.sorints
                              (sorints_pidm, sorints_ints_code,
                               sorints_activity_date)
                               values
                                v_pidm,
                                 v_activity1,
                                  sysdate
                WHEN (v_activity2 IS NOT NULL)
               THEN
                  INSERT INTO saturn.sorints
                              (sorints_pidm, sorints_ints_code,
                               sorints_activity_date)
                               values
                                v_pidm,
                                 v_activity2,
                                  sysdate
               WHEN (v_activity3 IS NOT NULL)
               THEN
                  INSERT INTO saturn.sorints
                              (sorints_pidm, sorints_ints_code,
                               sorints_activity_date)
                               values
                                v_pidm,
                                 v_activity3,
                                  sysdate
                WHEN (v_activity4 IS NOT NULL)
               THEN
                  INSERT INTO saturn.sorints
                              (sorints_pidm, sorints_ints_code,
                               sorints_activity_date)
                               values
                                v_pidm,
                                 v_activity4,
                                  sysdate
            END CASE;
         END IF;
      END LOOP;
It is working just for one activity (activity1) The variable definition is correctv_activity1 sorints.sorints_ints_code%TYPE;
v_activity2 sorints.sorints_ints_code%TYPE;
v_activity3 sorints.sorints_ints_code%TYPE;
v_activity4 sorints.sorints_ints_code%TYPE;
v_activity5 sorints.sorints_ints_code%TYPE;
v_activity6 sorints.sorints_ints_code%TYPE;
Edited by: peace4all on Aug 16, 2009 9:42 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

peace4all wrote:
It is working just for one activity (activity1) The variable definition is correct
Well, what else did you expect? CASE evaluates brances starting first one. If WHEN condition is not met it continues to next one. As soon as WHEN condition is met, THEN clause is executed after that CASE exits. You need to use IF statement, not case:
with t as (
           select to_date('01/11/2005','dd/mm/yyyy') Start_Date,to_date('13/11/2005','dd/mm/yyyy') End_Date,13 Days,'CMP1' Component,1000.00 Amount from dual union all
           select to_date('01/11/2005','dd/mm/yyyy'),to_date('13/11/2005','dd/mm/yyyy'),13,'CMP2',826.67 from dual union all
           select to_date('15/11/2005','dd/mm/yyyy'),to_date('20/11/2005','dd/mm/yyyy'),6,'CMP1',413.33 from dual union all
           select to_date('15/11/2005','dd/mm/yyyy'),to_date('20/11/2005','dd/mm/yyyy'),6,'CMP2',166.67 from dual union all
           select to_date('21/11/2005','dd/mm/yyyy'),to_date('28/11/2005','dd/mm/yyyy'),8,'CMP1',633.00 from dual union all
           select to_date('21/11/2005','dd/mm/yyyy'),to_date('28/11/2005','dd/mm/yyyy'),8,'CMP2',111.00 from dual union all
           select to_date('21/11/2005','dd/mm/yyyy'),to_date('28/11/2005','dd/mm/yyyy'),8,'CMP3',22.00 from dual union all
           select to_date('21/11/2005','dd/mm/yyyy'),to_date('28/11/2005','dd/mm/yyyy'),8,'CMP4',333.00 from dual union all
           select to_date('01/12/2005','dd/mm/yyyy'),to_date('15/12/2005','dd/mm/yyyy'),15,'CMP1',2480.00 from dual union all
           select to_date('01/12/2005','dd/mm/yyyy'),to_date('15/12/2005','dd/mm/yyyy'),15,'CMP2',1488.00 from dual union all
           select to_date('01/12/2005','dd/mm/yyyy'),to_date('15/12/2005','dd/mm/yyyy'),15,'CMP3',496.00 from dual union all
           select to_date('01/12/2005','dd/mm/yyyy'),to_date('15/12/2005','dd/mm/yyyy'),15,'CMP4',200.00 from dual union all
           select to_date('16/12/2005','dd/mm/yyyy'),to_date('31/12/2005','dd/mm/yyyy'),16,'CMP1',522.00 from dual union all
           select to_date('16/12/2005','dd/mm/yyyy'),to_date('31/12/2005','dd/mm/yyyy'),16,'CMP2',166.00 from dual union all
           select to_date('16/12/2005','dd/mm/yyyy'),to_date('31/12/2005','dd/mm/yyyy'),16,'CMP3',242.00 from dual
SELECT  P_Month,
        SUM(LEAST(LAST_DAY(P_Month),end_date) - GREATEST(P_Month,start_date) + 1) Total_Days
  FROM  t,
         SELECT  ADD_MONTHS(first_month,LEVEL - 1) P_Month
           FROM  (
                  SELECT  TRUNC(MIN(start_date),'MM') first_month,
                          TRUNC(MAX(end_date),'MM') last_month
                    FROM  t
           CONNECT BY LEVEL <= MONTHS_BETWEEN(last_month,first_month) + 1
  WHERE P_Month BETWEEN TRUNC(start_date,'MM') and end_date
  GROUP BY P_Month
  ORDER BY P_Month
with t as (
           select to_date('01/11/2005','dd/mm/yyyy') Start_Date,to_date('13/11/2005','dd/mm/yyyy') End_Date,13 Days,'CMP1' Component,1000.00 Amount from dual union all
           select to_date('01/11/2005','dd/mm/yyyy'),to_date('13/11/2005','dd/mm/yyyy'),13,'CMP2',826.67 from dual union all
           select to_date('15/11/2005','dd/mm/yyyy'),to_date('20/11/2005','dd/mm/yyyy'),6,'CMP1',413.33 from dual union all
           select to_date('15/11/2005','dd/mm/yyyy'),to_date('20/11/2005','dd/mm/yyyy'),6,'CMP2',166.67 from dual union all
           select to_date('21/11/2005','dd/mm/yyyy'),to_date('28/11/2005','dd/mm/yyyy'),8,'CMP1',633.00 from dual union all
           select to_date('21/11/2005','dd/mm/yyyy'),to_date('28/11/2005','dd/mm/yyyy'),8,'CMP2',111.00 from dual union all
           select to_date('21/11/2005','dd/mm/yyyy'),to_date('28/11/2005','dd/mm/yyyy'),8,'CMP3',22.00 from dual union all
           select to_date('21/11/2005','dd/mm/yyyy'),to_date('28/11/2005','dd/mm/yyyy'),8,'CMP4',333.00 from dual union all
           select to_date('01/12/2005','dd/mm/yyyy'),to_date('15/12/2005','dd/mm/yyyy'),15,'CMP1',2480.00 from dual union all
           select to_date('01/12/2005','dd/mm/yyyy'),to_date('15/12/2005','dd/mm/yyyy'),15,'CMP2',1488.00 from dual union all
           select to_date('01/12/2005','dd/mm/yyyy'),to_date('15/12/2005','dd/mm/yyyy'),15,'CMP3',496.00 from dual union all
           select to_date('01/12/2005','dd/mm/yyyy'),to_date('15/12/2005','dd/mm/yyyy'),15,'CMP4',200.00 from dual union all
           select to_date('16/12/2005','dd/mm/yyyy'),to_date('31/12/2005','dd/mm/yyyy'),16,'CMP1',522.00 from dual union all
           select to_date('16/12/2005','dd/mm/yyyy'),to_date('31/12/2005','dd/mm/yyyy'),16,'CMP2',166.00 from dual union all
           select to_date('16/12/2005','dd/mm/yyyy'),to_date('31/12/2006','dd/mm/yyyy'),381,'CMP3',242.00 from dual
SELECT  P_Month,
        SUM(LEAST(LAST_DAY(P_Month),end_date) - GREATEST(P_Month,start_date) + 1) Total_Days
  FROM  t,
         SELECT  ADD_MONTHS(first_month,LEVEL - 1) P_Month
           FROM  (
                  SELECT  TRUNC(MIN(start_date),'MM') first_month,
                          TRUNC(MAX(end_date),'MM') last_month
                    FROM  t
           CONNECT BY LEVEL <= MONTHS_BETWEEN(last_month,first_month) + 1
  WHERE P_Month BETWEEN TRUNC(start_date,'MM') and end_date
  GROUP BY P_Month
  ORDER BY P_Month
LOOP
         FETCH activities_cursor
          INTO v_pidm, v_activity1, v_activity2, v_activity3, v_activity4,
               v_activity5,v_activity6;
         EXIT WHEN activities_cursor%NOTFOUND;
         IF v_activity1 IS NOT NULL
               THEN
                  INSERT INTO saturn.sorints
                              (sorints_pidm, sorints_ints_code,
                               sorints_activity_date)
                               values
                                v_pidm,
                                 v_activity1,
                                  sysdate
          ELSIF v_activity2 IS NOT NULL
               THEN
                  INSERT INTO saturn.sorints
                              (sorints_pidm, sorints_ints_code,
                               sorints_activity_date)
                               values
                                v_pidm,
                                 v_activity2,
                                  sysdate
          ELSIF v_activity3 IS NOT NULL
               THEN
                  INSERT INTO saturn.sorints
                              (sorints_pidm, sorints_ints_code,
                               sorints_activity_date)
                               values
                                v_pidm,
                                 v_activity3,
                                  sysdate
          ELSIF v_activity4 IS NOT NULL
               THEN
                  INSERT INTO saturn.sorints
                              (sorints_pidm, sorints_ints_code,
                               sorints_activity_date)
                               values
                                v_pidm,
                                 v_activity4,
                                  sysdate
          END IF;
      END LOOP;SY.

Similar Messages

  • CASE Statement is not working Derived table

    Hi All,
    in the bello SQL Statement case statement is not working in derived table. I am new to creation of derived table if any body knows plz kinldy help me out on this.
    SELECT x.market, x.droprate as med1
    FROM
    (select upper(market_name) as market, fulldate as date_value,
         (sum([Dy_LOT_DROPS_N][Dy_OB_HO_DROPS][Dy_NonRF_Drop]))/
              nullif(sum(CASE WHEN (month(BBHDLY.FullDate)}>= 6 and { year(BBHDLY.FullDate)} = 2011) or {fn year(IDENSLABBHDLY.FullDate)} > 2011
    THEN  BBHDLY.Dy_Calls - BBHDLY.Dy_HO_CHAN_ALLOC ELSE BBHDLY.Dy_Calls END),0)*100 as droprate
    from BBHDLY sla
    inner join Dim mkt
         on sla.bts_name = mkt.bts_name and sla.SectorID = mkt.Sector_Id
                   where fulldate >= GETDATE()-46
                   group by market_name, fulldate) x,
    (select market_name as market, fulldate as date_value,
    (sum([Dy_LOT_DROPS_N][Dy_OB_HO_DROPS][Dy_NonRF_Drop]))/
              nullif(sum(CASE WHEN ({fn month(BBHDLY.FullDate)}>= 6 and {fn year(BBHDLY.FullDate)} = 2011) or {fn year(BBHDLY.FullDate)} >
    2011 THEN  BBHDLY.Dy_Calls - BBHDLY.Dy_HO_CHAN_ALLOC ELSE BBHDLY.Dy_Calls END),0)*100 as droprate
    from BBHDLY sla
    inner join Dim mkt
         on sla.bts_name = mkt.bts_name and sla.SectorID = mkt.Sector_Id
                   where fulldate >=GETDATE()-46
                   group by market_name, fulldate) y
    where x.market = y.market
    GROUP BY x.droprate, x.market
    HAVING
       SUM(CASE WHEN y.droprate <= x.droprate
          THEN 1 ELSE 0 END)>=(COUNT(*)+1)/2 AND
       SUM(CASE WHEN y.droprate >= x.droprate
          THEN 1 ELSE 0 END)>=(COUNT(*)/2)+1
    Thanks

    It looks like SQL Server or Sybase given that you're using getdate().
    As such, Vinesh's comment to use decode is wrong - decode is  Oracle syntax.
    Looking at your statement again, I've noticed the following:
    you have no { to match the first } - not sure why you're using them anyway.
    you haven't given x.market a name - use x.market as market instead
    use coalesce instead of nullif if you're on SQL Server.

  • NOT IN clause in CASE statement condition not working

    Dear Friends,
    I want to use below condition in WHERE clause of my SELECT statement.
    WHERE <...........>
    <...........>
    AND eihf.exr_aip_asset_sid NOT IN
    (CASE when safa.fund_relation = 'C' and safa.fund_account_code != vFundAccount
    THEN (37874,37909,43424,55040,59513,59598,58570,76148,75885,75927)
    ELSE
    (0)
    END
    But it gives me an error as "missing right parenthis".
    Please help.
    Regards,
    Jignesh

    CASE returns one and only one value. It can't return a list. Your satement should be something like:
    WHERE <...........>
    <...........>
    AND (
                 safa.fund_relation = 'C'
             AND
                 safa.fund_account_code != vFundAccount
             AND
                 eihf.exr_aip_asset_sid NOT IN (37874,37909,43424,55040,59513,59598,58570,76148,75885,75927)
         OR
             NOT (
                      safa.fund_relation = 'C'
                  AND
                      safa.fund_account_code != vFundAccount
             AND
                 eihf.exr_aip_asset_sid != 0
        )SY.

  • Insert statement will not work if select statement has less number of colum

    Hi,
    One of my thread is already resolved on the following URL : unable to insert rows into the table
    DROP TABLE TEMP;
    CREATE TABLE TEMP AS SELECT * FROM CASE_101 WHERE 1=2;
    DECLARE
    S VARCHAR2(200);
    STMT VARCHAR2(500);
    begin
    for C in (select TABLE_NAME INTO S from USER_TABLES where TABLE_NAME like 'CASE%' TABLE_NAME NOT like '%OLD' and Num_ROWS > 0 order by TABLE_NAME) loop
    STMT := 'INSERT INTO TEMP SELECT * FROM ';
    STMT:=STMT || C.TABLE_NAME;
    EXECUTE IMMEDIATE STMT;
    dbms_output.put_line(c.table_name);
    end loop;
    end;
    i am facing now some different; almost all the tables have same number of columns except in few of tables have some additional columns. As above i am creating a table "TEMP" who has highest column temp(by doing some manual process). The table who has less columns than "TEMP" table : Insert statement will not work. 'INSERT INTO TEMP SELECT * FROM less_columns_table_name'.
    Please let me know , how can i execute proper way.
    Thanks.
    Best Regards
    Arshad

    user13360241 wrote:
    Hi,
    One of my thread is already resolved on the following URL : unable to insert rows into the table
    DROP TABLE TEMP;
    CREATE TABLE TEMP AS SELECT * FROM CASE_101 WHERE 1=2;
    DECLARE
    S VARCHAR2(200);
    STMT VARCHAR2(500);
    begin
    for C in (select TABLE_NAME INTO S from USER_TABLES where TABLE_NAME like 'CASE%' TABLE_NAME NOT like '%OLD' and Num_ROWS > 0 order by TABLE_NAME) loop
    STMT := 'INSERT INTO TEMP SELECT * FROM ';
    STMT:=STMT || C.TABLE_NAME;
    EXECUTE IMMEDIATE STMT;
    dbms_output.put_line(c.table_name);
    end loop;
    end;
    i am facing now some different; almost all the tables have same number of columns except in few of tables have some additional columns. As above i am creating a table "TEMP" who has highest column temp(by doing some manual process). The table who has less columns than "TEMP" table : Insert statement will not work. 'INSERT INTO TEMP SELECT * FROM less_columns_table_name'.
    Please let me know , how can i execute proper way.
    Thanks.
    Best Regards
    Arshadmore often than not "TEMP" tables are NOT required & are highly inefficient in Oracle.
    Either only specify explicit column in TEMP to get data,
    or provide value for "extra" column in TEMP

  • Insert statement is not working for z table.

    Hi experts,
    My insert statement is not working.
    I have used follwing code to update z table .
    INSERT ztable FROM TABLE gt_table.
    here i have checked gt_table and its filled up with all the records properly.
    now the problem is in this table i have 15 fields and it inserts 14  fields of it but
    the last field is never inserted though in gt_table i can see value for last fields also.
    I have added this field in ztable recently . so i also used se14 to adjust table but still i am facing same problem.
    please help me out.
    thanks,
    Neo

    > > Table maintainance will have nothing to do with
    > this
    > > issue.
    >
    > It does sometimes when you are trying to see the
    > values from SM30 instead of SE16. The value may be
    > there, but it may just not seen in SM30 because the
    > table maintenance hasn't registered the addition of
    > new field.
    >
    > Another place to look at is the activation log to see
    > if there are any warnings issued there.
    You shouldn't use SM30 to view table entries. You use this transaction to maintain the table entries. Pure and Simple.

  • Delete Statement is not working correctly

    Hello,
    The following delete statement is not working correctly.
    If I press delete it will delete everything in the category table
    I don't know whats wrong with it.
    ----delete row from category if there is not infrastructure to support------
    IF :P12_DFCY_SEQNO4 IS NOT NULL AND :P12_DFCY_CATG_C = '7' THEN
    DELETE FROM DFCY_CATG
    WHERE NOT EXISTS(SELECT I.DFCY_SEQNO
    FROM DFCY_CATG C, DFCY_CATG_INFRSTRCTR I
    WHERE C.DFCY_SEQNO = I.DFCY_SEQNO
    AND :P12_DFCY_SEQNO4 = I.DFCY_SEQNO);
    end if;
    Thanks
    Mary

    Hi,
    IF :P12_DFCY_SEQNO4 IS NOT NULL AND :P12_DFCY_CATG_C = '7' THEN
    DELETE FROM DFCY_CATG
    WHERE NOT EXISTS(SELECT I.DFCY_SEQNO
    FROM DFCY_CATG C, DFCY_CATG_INFRSTRCTR I
    WHERE C.DFCY_SEQNO = I.DFCY_SEQNO
    AND :P12_DFCY_SEQNO4 = I.DFCY_SEQNO);
    end if;So, if P12_DFCY_SEQNO4 does not exist, then I would expect all records to be deleted because the NOT EXISTS() function would just return TRUE for every record on the table. Somewhere in the statement, I would expect to see something that links between the table being deleted from and the NOT EXISTS() data or, perhaps, using the P12_DFCY_CATG_C value as a filter?
    Andy

  • Delete statement is not working.

    Hi,
    find the code. Here the delete statement is not working and i am getting sy-subrc = 4. although ,
    xe1edp10-idnkd = 34596 and dint_edidd -sdata = 34596.
    please help me ...
    loop at dekek_x.
    loop at dint_edidd where segnam = 'E1EDP10'.
    if dekek_x-stpin = 1 .
    CLEAR xe1edp10.
      MOVE dint_edidd-sdata TO xe1edp10.
    delete dint_edidd where sdata = xe1edp10-idnkd.
    endif.
    endloop.

    1st thing..
    i tried this :
    tables: edidd, e1edp10.
    edidd-sdata = '315934 EA 017'.
    WRITE edidd-sdata.
    move edidd-sdata to e1edp10.
    IF edidd-sdata = e1edp10-idnkd.
    WRITE: e1edp10-idnkd.
    else.
      WRITE: 'nothing'.
    ENDIF.
    output
    >315934 EA 017
    >315934 EA 017
    2nd thing,.
    your loop inside loop doesnt make any sense as they are not related any where.
    3rd thing:
    the fields are not type compatible.. this might be the reason for wrong delete statement..
    and 1 more clarification:
    TABLES: edidd, e1edp10.
    DATA :it TYPE TABLE OF edidd WITH HEADER LINE.
    edidd-sdata = '315934 EA 017'.
    WRITE edidd-sdata.
    APPEND edidd TO it.
    edidd-sdata = '315934 EA 018'.
    APPEND edidd TO it.
    LOOP AT it." where segnam = 'E1EDP10'.
      CLEAR e1edp10.
      MOVE it-sdata TO e1edp10.
      DELETE it WHERE sdata = e1edp10-idnkd.
    ENDLOOP.
    in this also delete is working perfectly fine... you run and check..

  • SORT statement is not working!

    Hi frdz,
    Below SORT statement is not working. Can any one explain me why this is happening.
    SORT i_bseg ASCENDING BY belnr bukrs
                        DESCENDING kunnr.
    I have table content as below.
    BELNR      BUKRS KUNNR   
    0016000000|CROP |         
    0016000000|CROP |0008910168
    Before and after the sort content order is same.
    I want to sort the content like below.
    0016000000|CROP |0008910168
    0016000000|CROP |       
    Is there any thing wrong with the sort statement???
    i_bseg is defined as TYPE STANDARD TABLE OF
    Sort criteria must not change i. e ascending by belnr and bukrs and descending by kunnr.
    Thanks,
    Vinod.

    hi vinod,
    this is because on your statement, you are sorting BUKRS in descending order and KUNNR in ASCENDING order.
    please take note that the sort order should come after the sorted field. if no order is given, the default which is ASCENDING will be used.
    do your sorting like this
    SORT i_bseg BY belnr bukrs kunnr DESCENDING.
    regards,
    Peter

  • Upper case "s" does not work in most programs

    Upper case "s" does not work in a number of programs, lower case is fine. It is the only letter that is missing in both cases.
    Any ideas. Do I need to reinstall driver for keyboard? If so any idea where to get it.

    Open the Speech pane of System Preferences and check whether either the listening key or the speech key has become set to that keystroke; if so, change the setting.
    (41135)

  • Message statement is not working?

    I would like to place a message in the following method:
    It's defined like this:
    Position & cannot be delimited because the position is occupied until &
    This is in the program:
    MESSAGE: s029(zpom_001) WITH st_hrp1001-objid(8) st_hrp1001-endda(8), display like 'E'.
    I inserted the (display like 'E' ) in so I can get the RED 'X' error message.  If I take out the display like 'E', it works.
    I get the following error:
    Three-digit error number XXX required in the "MESSAGE EXXX..." statement.
    Thanks for any help you can give?
    Jeff

    Satish,
    That did not work...
    If I remove the part of the message (  Display like 'E' )  it works......  But if I want to get a RED X error message, what would I do?
    JeffG

  • CASE function is not working

    Hi,
    I want to use the CASE function in a sql statement used at form level but it's not working. I can't compile the form. I am using developer 6i at font end and Oracle 10g database at back end. Is it possible to use case function at form level sql statement. If so then please help me about it.
    Best Regards

    Forms has it's own PL/SQL engine, and in Forms 6i it's version 8 where no CASE was available. So if you want to use CASE you'll have to use a view or put your logic in a stored procedure.

  • Case when then not working

    In my database, two variable ID and time (varchar2) are there. I want to populate another variable using case when then by putting below conditon to convert like this
    But its not working. Can anyone help me
    if time =1 day then '1 Day'
    time > 2 days and time <=7 days then '2 to 7 days'
    time > 8 days and time <=15 days then '8 to 15 days'
    else 'not matching'
    ID Time
    12 1 days
    23 244 days
    12 2 days
    14 4 days
    15 6 days
    17 9 days
    select time,
    case WHEN
    UPPER(Time) = '1 DAY'
    THEN
    '1 day'
    WHEN
    UPPER(Time) Between '2 DAYS' and '7 DAYS'
    THEN
    '2 to 7 days'
    WHEN
    UPPER(Time) Between '8 DAYS' and '15 DAYS'
    THEN
    '8 to 15 days'
    ELSE
    'Not matching'
    END "update time"
    from table1

    900487 wrote:
    In my database, two variable ID and time (varchar2) are there. If you are storing Days in a column store it as NUMBER or INTERVAL data type. The way you have stored the value looks incorrect.
    What you can do is extract the number portion of your time column and apply the CASE statement. Something like this
    SQL> with t
      2  as
      3  (
      4  select 12 id, '1 days' time1 from dual union all
      5  select 23 id, '244 days' time1 from dual union all
      6  select 12 id, '2 days' time1 from dual union all
      7  select 14 id, '4 days' time1 from dual union all
      8  select 15 id, '6 days' time1 from dual union all
      9  select 17 id, '9 days' time1 from dual
    10  )
    11   select id,
    12          time1,
    13          case when time1 = 1              then '1 day'
    14               when time1 between 2 and 7  then '2 to 7 days'
    15               when time1 between 8 and 15 then '8 to 15 days'
    16               else 'not matching'
    17          end "update time"
    18     from (
    19              select id, to_number(regexp_substr(time1, '^[[:digit:]]*')) time1
    20                from t
    21          )
    22  /
            ID      TIME1 update time
            12          1 1 day
            23        244 not matching
            12          2 2 to 7 days
            14          4 2 to 7 days
            15          6 2 to 7 days
            17          9 8 to 15 days
    6 rows selected.

  • Count Distinct Wtih CASE Statement - Does not follow aggregation path

    All,
    I have a fact table, a day aggregate and a month aggregate. I have a time hierarchy and the month aggregate is set to the month level, the day aggregate is set to the day level within the time hierarchy.
    When using any measures and a field from my time dimension .. the appropriate aggregate is chosen, ie month & activity count .. month aggregate is used. Day & activity count .. day aggregate is used.
    However - when I use the count distinct aggregate rule .. the request always uses the lowest common denominator. The way I have found to get this to work is to use a logical table source override in the aggregation tab. Once I do this .. it does use the aggregates correctly.
    A few questions
    1. Is this the correct way to use aggregate navigation for the count distinct aggregation rule (using the source override option)? If yes, why is this necessary for count distinct .. what is special about it?
    2. The main problem I have now is that I need to create a simple count measure that has a CASE statement in it. The only way I see to do this is to select the Based on Dimensions checkbox which then allows me to add a CASE statement into my count distinct clause. But now the aggregation issue comes back into play and I can't do the logical table source override when the based on dimensions checkbox is checked .. so I am now stuck .. any help is appreciated.
    K

    Ok - I found a workaround (and maybe the preferred solution for my particular issue), which is - Using a CASE Statement with a COUNT DISTINCT aggregation and still havine AGGREGATE AWARENESS
    To get all three of the requirements above to work I had to do the following:
    - Create the COUNT DISTINCT as normal (counting on a USERID physically mapped column in my case)
    - Now I need to map my fact and aggregates to this column. This is where I got the case statement to work. Instead of trying to put the case statement inside of the Aggregate definition by using the checkbox 'Base on Dimension' (which didnt allow for aggregate awareness for some reason) .. I instead specified the case statement in the Column Mapping section of the Fact and Aggregate tables.
    - Once all the LTS's (facts and aggregates) are mapped .. you still have to define the Logical Table Source overrides in the aggregate tab of the count distinct definition. Add in all the fact and aggregates.
    Now the measure will use my month aggregate when i specify month, the day aggregate when i specify day, etc..
    If you are just trying to use a Count Distinct (no CASE satement needed) with Aggregate Awareness, you just need to use the Logical Table Source override on the aggregate tab.
    There is still a funky issue when using the COUNT aggregate type. As long as you dont map multiple logical table sources to the COUNT column it works fine and as expected. But, if you try to add in multiple sources and aggregate awareness it randomly starts SUMMING everything .. very weird. The blog in this thread says to check the 'Based on Dimension' checkbox to fix the problem but that did not work for me. Still not sure what to do on this one .. but its not currently causing me a problem so I will ignore for now ;)
    Thanks for all the help
    K

  • SELECT statement does not work if characters ## are contained in field

    Hi Experts,
    I have the following statement:
    select single field1
        from table1
        into var1
        where field2 = text.
    This is a very simple statement that is working for me almost always correct. However there is a situation where the system is not able to find the record in my table. If text is equal to JAN##2011 the system won't deliver a result even if I have an entry in table1 with exactly this value.
    TABLE1
    field1 field2
    rome JAN##2011
    paris JAN2011
    only if text is JAN2011 the select will find a result.
    all fields are defined as CHAR.
    Thanks in advanced

    Hi Alberto,
    probably ## is not ## :-).
    is the visible representation used by ABAP to show any non-displayable characters as control characters like TAB, CR, LF, FF and the like.
    In debugger you can switch to HEX display of values, if you see something like 0A0D you can find this using CL_ABAP_CHAR_UTILITIES constant attributes.
    Regards
    Clemens

  • pcs:insert not working correctly in Content Server 6.0

    Hello,
    I'm having a difficult time getting the <pcs:insert> tag working in Content Server 6.0. In the previous version of Content Server, I used <pcs:insert expr="mycontentitem"></pcs:insert> and the content item that I want inserted shows up fine. Now when I try it in Content Server 6.0, the inserted (child) content item tries to reference the parent's content item variables, giving me nothing. Also, I have tried using <pcs:insert path="mycontentitem"> to the same result.
    Any help, or example of a working <pcs:insert> for Content Server 6.0 would be a lifesaver!
    Thank you,
    PK

    We have the same problem with "INSERT" tags not working in the newest version CS6.0. I am a bit surprised that anyone had replied to your post to give us some explanations or directions how to solve the problem. It looks as a serious problem to me.

Maybe you are looking for

  • How to find out Number of entries in a Huge Table?

    Hi, I would like to know Number of entries in table DFKKOP. when i try to get it through se16, it takes more than 10 minutes in dialogue process so a time out occurs. is there any way to find out number of entries in the table Apart from creating a p

  • [svn:fx-trunk] 10506: New TLF file missing from svn 10505.

    Revision: 10506 Author:   [email protected] Date:     2009-09-22 10:43:46 -0700 (Tue, 22 Sep 2009) Log Message: New TLF file missing from svn 10505. Added Paths:     flex/sdk/trunk/frameworks/projects/textLayout/textLayout_edit/src/flashx/textLayout/

  • Mac Mini Investment?

    Hi, I am wanting to get some input from others about the Mac Mini. I am thinking about purchasing the Mac Mini along with the 27" Thunderbolt. Use: I run an online e commerce site and I do a lot of designing and reporting on my products. I don't game

  • What is the difference between Satellite A300-1EC & Satellite A300-1EG

    Why does the Satellite A300-1EC stand dearer as Satellite A300-1EG, but on configuration loses him? What is their substantial distinction in? What model of notebook can advise, in this price range?

  • Visual Composer VC implemented in WAD BEx Web Application

    Hi, is it possible to implement visual composer graphic into simple WAD BEx Web Template? If yes, how? Thank you for any hints. Greetings Standa