Issue with case statement

100*ifnull(x,1)/case when ifnull(yagox,1)=0 then 1 else yagox end)
based on above condition my result should be like below
99.8
101.1
99.4
97.7
Current displaying result like below
99.8
1,22,345,000
99.4
97.7
2,34,567,400
i need to display those two values also in %
it may be happen denominater(yagox value is 1)
could please give the proper case statement for resolving the issue
betham
Edited by: 961992 on Oct 22, 2012 10:15 PM

Dear betham,
welcome to the forum, could you please share the table structure and some sample data and also what your select statement is. This will help people come up with solution faster and also it would avoid going in loops.

Similar Messages

  • 11g outer join with case statement - strange results.

    Hello All,
    I am experiencing a strange issues in 11g while using case statement.
    I am not able to reproduce this using sample data. Not sure what is wrong.
    I am not narrowing it to say the usage of case statemnt is giving wrong results, but that is my observation when I am doing trail and error testing.
    Here are the details.
    My Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    SQL> My Query
    SELECT *
      FROM (SELECT DISTINCT mf.schedule,
                            mf.cptcode,
                            NVL (mf.modifier, '00') modifier2,
                            CASE
                               WHEN mf.feetype = 'H'
                                AND mf.multiplier IS NOT NULL THEN
                                  '      0.00'
                               WHEN (mf.feetype != 'H'
                                  OR  mf.feetype IS NULL)
                                AND mf.rbrvsvalue IS NOT NULL
                                AND mf.multiplier IS NOT NULL THEN
                                  LPAD ( TRIM (TO_CHAR ( (mf.rbrvsvalue * mf.multiplier) / 100, 9999999.99)), 10)
                               ELSE
                                  NULL
                            END
                               fee
              FROM provider.mpifee mf, mpi_udffee.udffeeactivecptcodes vld
             WHERE mf.schedule = 'SAPG1'
               AND mf.cptcode = vld.cptcode
               AND NVL (mf.modifier, 'NULL') = NVL (vld.modifier, 'NULL')) inline_fee,
           (SELECT arc.schedule col1, arc.procedurecode col2, NVL (arc.modifier, '00') AS col3
              FROM mpi_udffee.udffeeancfeedata arc
             WHERE monthofextract = '201202'
               AND arc.schedule = 'SAPG1'
               AND TRUNC (SYSDATE - 10) BETWEEN arc.recordeffectivedate AND arc.recordterminationdate) inline_data
    WHERE inline_fee.schedule = inline_data.col1(+)
       AND inline_fee.cptcode = inline_data.col2(+)
       AND inline_fee.modifier2 = inline_data.col3(+);
    In the above query the inline view inline_data returns zero rows. but NVL is still getting applied for col3 and I am getting 00 in the results( strange ).
    Results:
    SCHEDULE        CPTCO MODIFIER2  FEE             COL1  COL2  COL3
    SAPG1           49590 00             667.32                  00
    SAPG1           49611 00             781.03                  00
    SAPG1           49905 00             443.79                  00
    SAPG1           50205 00             883.56                  00
    SAPG1           50220 00            1315.15                  00
    SAPG1           50230 00            1638.74                  00
    SAPG1           50234 00            1666.16                  00
    SAPG1           50250 00            1566.14                  00
    SAPG1           50327 00             262.04                  00
    SAPG1           50541 00            1183.31                  00
    SAPG1           50620 00            1156.88                  00
    SAPG1           50650 00            1321.96                  00
    497 rows selected.
    Just the inline view inline_data,
    SQL> SELECT arc.schedule col1, arc.procedurecode col2, NVL (arc.modifier, '00') AS col3
      2            FROM mpi_udffee.udffeeancfeedata arc
      3           WHERE monthofextract = '201202'
      4             AND arc.schedule = 'SAPG1'
      5             AND TRUNC (SYSDATE - 10) BETWEEN arc.recordeffectivedate AND arc.recordterminationdate;
    no rows selectedMuch unusual thing is when I just remove the case statement from the inline view "inline_fee", I am getting right results,
    SELECT *
      FROM (SELECT DISTINCT mf.schedule,
                            mf.cptcode,
                            NVL (mf.modifier, '00') modifier2          <-- Removed Case statement here
              FROM provider.mpifee mf, mpi_udffee.udffeeactivecptcodes vld
             WHERE mf.schedule = 'SAPG1'
               AND mf.cptcode = vld.cptcode
               AND NVL (mf.modifier, 'NULL') = NVL (vld.modifier, 'NULL')) inline_fee,
           (SELECT arc.schedule col1, arc.procedurecode col2, NVL (arc.modifier, '00') AS col3
              FROM mpi_udffee.udffeeancfeedata arc
             WHERE monthofextract = '201202'
               AND arc.schedule = 'SAPG1'
               AND TRUNC (SYSDATE - 10) BETWEEN arc.recordeffectivedate AND arc.recordterminationdate) inline_data
    WHERE inline_fee.schedule = inline_data.col1(+)
       AND inline_fee.cptcode = inline_data.col2(+)
       AND inline_fee.modifier2 = inline_data.col3(+);
    SCHEDULE        CPTCO MODIFIER2  COL1  COL2  COL3
    SAPG1           46730 00
    SAPG1           46735 00
    SAPG1           46748 00
    SAPG1           46760 00
    SAPG1           46942 00
    SAPG1           46945 00
    SAPG1           47015 00
    SAPG1           47125 00
    SAPG1           47350 00
    SAPG1           47505 00
    SAPG1           47553 00interestingly explain plan for both the statements are exactly same,
    SELECT STATEMENT  ALL_ROWSCost: 138  Bytes: 1,078,274  Cardinality: 11,471                                
         9 HASH JOIN RIGHT OUTER  Cost: 138  Bytes: 1,078,274  Cardinality: 11,471                           
              2 PARTITION RANGE EMPTY  Cost: 2  Bytes: 150  Cardinality: 3                      
                   1 TABLE ACCESS FULL TABLE MPI_UDFFEE.UDFFEEANCFEEDATA Cost: 2  Bytes: 150  Cardinality: 3                 
              8 VIEW MPI_UDFFEE. Cost: 135  Bytes: 504,724  Cardinality: 11,471                      
                   7 HASH UNIQUE  Cost: 135  Bytes: 539,137  Cardinality: 11,471                 
                        6 HASH JOIN  Cost: 134  Bytes: 539,137  Cardinality: 11,471            
                             3 TABLE ACCESS FULL TABLE MPI_UDFFEE.UDFFEEACTIVECPTCODES Cost: 13  Bytes: 177,345  Cardinality: 25,335       
                             5 PARTITION LIST SINGLE  Cost: 120  Bytes: 600,600  Cardinality: 15,015  Partition #: 8       
                                  4 INDEX RANGE SCAN INDEX (UNIQUE) REPRICE.PK_MPIFEE Cost: 120  Bytes: 600,600  Cardinality: 15,015  Partition #: 9  Partitions accessed #11Is there anything wrong with the query? If not have anyone come across this issue or posted it as a bug or is there a patch?
    Update:
    when I set the parameter "_complex_view_merging"=false I am getting the right results even with case statement. But I don want to do some thing unsupported.
    Are there any other viable solutions?
    I appreciate the help.
    Thanks,
    G.
    Edited by: Ganesh Srivatsav on Apr 10, 2012 12:37 PM

    Hi Tubby,
    Right, the query transformation is going wrong. Following is from trace,
    SELECT "INLINE_FEE"."SCHEDULE" "SCHEDULE",
           "INLINE_FEE"."CPTCODE" "CPTCODE",
           "INLINE_FEE"."MODIFIER2" "MODIFIER2",
           "INLINE_FEE"."FEE" "FEE",
           "ARC"."SCHEDULE" "COL1",
           "ARC"."PROCEDURECODE" "COL2",
           CASE
              WHEN "ARC".ROWID IS NOT NULL THEN NVL ("ARC"."MODIFIER", '00')
              ELSE NULL
           END
              "COL3"
      FROM (SELECT DISTINCT "MF"."SCHEDULE" "SCHEDULE",
                            "MF"."CPTCODE" "CPTCODE",
                            NVL ("MF"."MODIFIER", :B2) "MODIFIER2",
                            CASE
                               WHEN ("MF"."FEETYPE" = :B3
                                 AND "MF"."MULTIPLIER" IS NOT NULL) THEN
                                  :B4
                               WHEN ( ("MF"."FEETYPE" <> :B5
                                    OR  "MF"."FEETYPE" IS NULL)
                                 AND "MF"."RBRVSVALUE" IS NOT NULL
                                 AND "MF"."MULTIPLIER" IS NOT NULL) THEN
                                  LPAD ( TRIM (TO_CHAR ( "MF"."RBRVSVALUE" * "MF"."MULTIPLIER" / :B6, :B7)), :B8)
                               ELSE
                                  NULL
                            END
                               "FEE"
              FROM "PROVIDER"."MPIFEE" "MF", "MPI_UDFFEE"."UDFFEEACTIVECPTCODES" "VLD"
             WHERE "MF"."SCHEDULE" = 'SAPG1'
               AND "MF"."CPTCODE" = "VLD"."CPTCODE"
               AND NVL ("MF"."MODIFIER", 'NULL') = NVL ("VLD"."MODIFIER", 'NULL')) "INLINE_FEE",
           "MPI_UDFFEE"."UDFFEEANCFEEDATA" "ARC"
    WHERE "INLINE_FEE"."SCHEDULE" = "ARC"."SCHEDULE"(+)
       AND "INLINE_FEE"."CPTCODE" = "ARC"."PROCEDURECODE"(+)
       AND "INLINE_FEE"."MODIFIER2" = CASE
                                         WHEN ("ARC".ROWID(+) IS NOT NULL) THEN NVL ("ARC"."MODIFIER"(+), '00')
                                         ELSE NULL
                                      END
       AND "ARC"."MONTHOFEXTRACT"(+) = '201202'
       AND "ARC"."SCHEDULE"(+) = 'SAPG1'
       AND TRUNC (SYSDATE-10) >= "ARC"."RECORDEFFECTIVEDATE"(+)
       AND TRUNC (SYSDATE-10) <= "ARC"."RECORDTERMINATIONDATE"(+)Does this refer to a specific bug?
    Thanks,
    G.

  • Using Presentation variables..along with case statements..

    Hi All.
    I have a issue using presentation variable along with CASE statements. My approach is
    1) I have a dashboard prompt, which is being set as Presentation variable.
    Based on the value selected in prompt, for ex the values of prompt can be 'ABC' and 'DEF'.
    I have a calculated column, the calculation goes this way...
    The forumal is
    CASE WHEN @{Presentation Variable Name} = 'ABC' THEN xxxxxxxxxx ELSE IF @{Presentation Variable Name} = 'DEF' END. It gives error of "no table being referenced"..
    Is this is the right approach??
    Can i get the values of variable in a column formula, so that a column can have values selected in prompt?
    Can anybody pls help me here..
    Thanks in advance...

    Hi
    Thanks for the quick response..
    I agree to ur point..
    But the requirement is
    Based on the value of the prompt I need to switch the calculation in one of the formula area of one column..
    If Prompt value is ABC then one kind of calculation in Fx and If the prompt value is DEF then one kind of calculation in the same Fx..
    How can I acheive this?
    Thanks in advance..

  • SQL Expression Field - Combine Declared Variable With Case Statement

    Hello All, I have been using Crystal & Business Objects for a few months now and have figured out quite a bit on my own. This is the first real time I have struggled with something and while I could do this as a Formula Field I would like to know how to do this as a SQL Expression. Basically I want to create a SQL Expression that uses a CASE statement but I wanted to make the code a little more efficient and employ a variable to hold a string and then use the variable in the CASE statement. The expression editor accepts the CASE statement OK but I don't know how to declare the variable. Please assist with the syntax?
    This is what I have:
    CASE
       WHEN u201CDatabaseu201D.u201DFieldu201D = u2018Hu2019 THEN u2018Hedgeu2019
       WHEN u201CDatabaseu201D.u201DFieldu201D = u2018Pu2019 THEN u2018PVIu2019
       ELSE u2018Noneu2019
    END
    This is what I want:
    DECLARE strVar AS VARCHAR(25)
    strVar =  u201CDatabaseu201D.u201DFieldu201D
    CASE
       WHEN strVar = u2018Hu2019 THEN u2018Hedgeu2019
       WHEN strVar = u2018Pu2019 THEN u2018PVIu2019
       ELSE u2018Noneu2019
    END

    Hi Todd,
    Please use the following for loop; your problem will be solved.
    Local StringVar str := "";
    Local NumberVar strLen := Length ({Database.Field});
    Local NumberVar i;
    For i := 1 To strLen Do
           if {Database.Field} <i> = "H" then str := "Hedge"
            else if {Database.Field} <i> = "P" then str := "PVI"
            else str := "None"; exit for
    str
    Let me know once done!
    Thank you,
    Ashok

  • Has anybody had an issue with System State Backups on a Dell PowerEdge R510 Server running Server 2008 R2?

    Hi,
    We have recently had issues running system state backups on our 2008 R2 Domain Controllers.  They are running on Dell PowerEdge R510 Physical Hardware.  Whenever you initiate a system state backup,  the Domain Controller becomes unresponsive
    forcing us to physically reboot it.   Nothing in the Event logs or the Dell Open Management Hardware Software indicates issues with Phyiscal disks but we can always replicate the issue by starting the system state backup. 
    The system state backup is initialted as a batch file that runs as a scheduled task.   the commands run are as follows:
    WBADMIN START SYSTEMSTATEBACKUP -backupTarget:[drive letter] -quiet
    We have 4 Domain Controllers with identical disk configurations.  When the DCs were setup I confirmed the system state backups were working but the issue started occuring sometime in Dec 2014.  We are going to run the Dell Hardware Update Utility
    to update the RAID, BIOS, Firmware updates but Has anyone experienced a similar issue that may have been triggerd by a Microsoft Patch?
    Thanks,
    Kevin C.
    kconway@fnalgov
    

    Hi Kevin,
    This issue could be due to the Mountmgr.sys driver incorrectly maintains a global mutex. This behavior causes a deadlock situation in the Mountmgr.sys driver.
    Please install the hotfix in the article below to resolve the issue:
    A computer stops responding because of a deadlock situation in the Mountmgr.sys driver in running Windows 7 or in Windows Server 2008 R2 
    http://support.microsoft.com/kb/2614892
    Best Regards,
    Mandy
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Problem with Case statement

    I friends,
    I am using a case statement for a number field like this
    case when (customer_no is null or customer_no ='') then t.customer_no else gv.customer_no end as customer_no
    When i complie this i get an errror ORa-00932 inconsistent data types expected char got number....
    when i remove the case statement the query runs fine so i am sure its the case statement thats wrong here..Am i checking it the wrong way...
    Thank you in advance

    874167 wrote:
    I friends,
    I am using a case statement for a number field like this
    case when (customer_no is null or customer_no ='') then t.customer_no else gv.customer_no end as customer_no
    When i complie this i get an errror ORa-00932 inconsistent data types expected char got number....
    when i remove the case statement the query runs fine so i am sure its the case statement thats wrong here..Am i checking it the wrong way...
    Thank you in advancewith Oracle strings are enclosed in single quote marks
    so Oracle is confused & unhappy with line below
    customer_no =''
    since CUSTOMEER_NO is a NUMBER
    why do you compare number to a string?

  • Handling Exceptions with case statement - convert Exception to int value

    Hi,
    I'm developing a web app, with servlets.
    I'm catching Exceptions in my servlets, for example I would like a user to insert data into a form. If the data cannot be converted into a integer value a java.lang.NumberormatException is thrown.
    I would like to catch this and then create a message giving a more specific clue to what happened. Unfortunatly it's possible that other exceptions could be caught, so I want to be able to check which type of Exception has been caught.
    I started writing a getErrorMessage(int Code) class. The method has a case statement which just checks the code and return the appropriate message.
    This worked well for SQL exceptions as they provide a getErrorCode method. But I was wondering is there any way to convert other Exceptions such as
    java.lang.NumberormatException into an integer value?
    Cheers

    Exceptions have their types (classes) and messages (and maybe an embedded exception). That is, they have much richer internal status then an integer.
    Why should they be "converted" to integers?
    FLAME on
    Gone are the days of good old errno.
    FLAME off

  • Insert data with Case Statement

    Good Morning,
    I created table:
    CREATE TABLE DWG_LOG
    (     DL_ID_PK NUMBER NOT NULL ENABLE,
         DL_DRWNG_ID_FK"NUMBER,
         DL_REQUESTOR VARCHAR2(400 BYTE),
         DL_PHONE VARCHAR2(40 BYTE),
         DL_DATE_COPIED DATE,
         DL_APPROVER VARCHAR2(400 BYTE),
         DL_NOTES VARCHAR2(100 BYTE),
         DL_REQ_EMAIL VARCHAR2(60 BYTE),
         DL_DATE_DUE DATE,
         DL_PAST_DUE VARCHAR2(400 BYTE))
    The goal is to populate the DL_PAST_DUE field with a 1 if the date is greater than 90 days else leave NULL. With the help of other more senior developers from OTN I have narrowed my logic to using a CASE Statement instead of a FUNCTION. Below is the projected CASE statement that I am trying to use:
    DECLARE
    v_copied_date DWG_LOG.DL_DATE_COPIED%TYPE;
    v_curr_date SYSDATE;
    BEGIN
    SELECT DL_DATE_COPIED INTO v_copied_date
    FROM DWG_LOG
    CASE
    WHEN (v_curr_date - v_copied_date) > 90 THEN
    INSERT INTO DWG_LOG (DL_PAST_DUE) VALUES ('1');
    ELSE
    INSERT INTO DWG_LOG (DL_PAST_DUE) VALUES ('0');
    END CASE;
    END;
    I am getting the following errors when I run this code in SQL*PLus:
    ERROR at line 10:
    ORA-06550: line 10, column 4:
    PL/SQL: ORA-00933: SQL command not properly ended
    ORA-06550: line 7, column 4:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 12, column 4:
    PLS-00103: Encountered the symbol "ELSE" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimite
    ORA-06550: line 14, column 8:
    PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
    if
    PLEASE, point me in the right direction I know my syntax is off I just don't know where. I will continue to research and refine my script.
    HUMBLY SUBMITTED
    Markus

    I APOLOGIZE
    Good Morning, I created table:
    CREATE TABLE DWG_LOG (
    DL_ID_PK NUMBER NOT NULL ENABLE,
    DL_DRWNG_ID_FK"NUMBER,
    DL_REQUESTOR VARCHAR2(400 BYTE),
    DL_PHONE VARCHAR2(40 BYTE),
    DL_DATE_COPIED DATE,
    DL_APPROVER VARCHAR2(400 BYTE),
    DL_NOTES VARCHAR2(100 BYTE),
    DL_REQ_EMAIL VARCHAR2(60 BYTE),
    DL_DATE_DUE DATE,
    DL_PAST_DUE VARCHAR2(400 BYTE))
    [pre/]
    The goal is to populate the DL_PAST_DUE field with a 1 if the date is greater than 90 days else leave NULL. With the help of other more senior developers from OTN I have narrowed my logic to using a CASE Statement instead of a FUNCTION. Below is the projected CASE statement that I am trying to use:
    DECLARE
    v_copied_date DWG_LOG.DL_DATE_COPIED%TYPE;
    v_curr_date SYSDATE;
    BEGIN
    SELECT DL_DATE_COPIED INTO v_copied_date
    FROM DWG_LOG;
    CASE
    WHEN    (v_curr_date - v_copied_date) > 90 THEN
    INSERT INTO DWG_LOG (DL_PAST_DUE) VALUES ('1');
    ELSE
    INSERT INTO DWG_LOG (DL_PAST_DUE) VALUES ('0');
    END CASE;
    END;
    I am getting the following errors when I run this code in SQL*PLus: ERROR at line 10: ORA-06550: line 10, column 4: PL/SQL: ORA-00933: SQL command not properly ended ORA-06550: line 7, column 4: PL/SQL: SQL Statement ignored ORA-06550: line 12, column 4: PLS-00103: Encountered the symbol "ELSE" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimite ORA-06550: line 14, column 8:
    PLS-00103: Encountered the symbol “CASE” when expecting one of the following:
    if                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to use Substring function with Case statement.

    Hello Everyone,
    I have one requirement where I have to use substring function on the field for report criteria.
    E.G.
    I have Branch Name Field where I have all branch names information, Now some of the branch names are too big with some extension after the name .
    now i want to substing it but the character length varies for each branch.
    so is there any way where we can use case statement where we can define that if branch name character are exceeding some value then substing it with this length.

    Try something like this:
    CASE WHEN LENGTH(tablename.Branch_Name) > n THEN SUBSTRING(...) ELSE tablename.Branch_Name END
    where n is the number of characters you want to start the break.

  • Issue with active state on navigation of vertical slide website. Please help!

    Hey guys!
    I'm using the Adtile vertical-slide example at http://www.adtile.me/fixed-nav/ and am having some issues with the navigation...
    When I add nav buttons for external pages, the navigation active state doesn't follow through the menu to the active slide (it does on the external pages as I'm using a separate css selector PHP script though). Without the additional buttons for the external pages they work fine.
    Here's the link to the working example WITHOUT the additional buttons for external pages.
    Here's the link for the page WITH the additional buttons for external pages.
    Does anyone know how I can get the active state to work for the slides section of the website?
    Thank you!
    SM

    Try this:
    .nav-collapse a:hover,
    .nav-collapse a:active,
    .nav-collapse a:focus {
      background: #e8e8e8;
    Nancy O.

  • Update with case statement problem.

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

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

  • Update statement with case statement

    Hi
    The following code is thorwing an error like
    =====CODE==========
    BEGIN
    UPDATE emp SET SAL = CASE
    WHEN ENAME = 'SCOTT' THEN SAL = 300
    ELSE NULL;
    END CASE;
    END;
    =====ERROR=======
    ORA-06550: line 3, column 32:
    PL/SQL: ORA-00905: missing keyword
    ORA-06550: line 2, column 2:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 5, column 6:
    PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
    ; 1.
    2. BEGIN
    3. UPDATE emp SET SAL = CASE
    4. WHEN ENAME = 'SCOTT' THEN SAL = 300
    5. ELSE NULL;
    Any suggession?
    Regards
    Balaji

    Hi,
    Yes you are right, but it is not working for the multiple case statement like the following code
    BEGIN
    UPDATE emp SET SAL = CASE
    WHEN ENAME='JONES' THEN '4';
    WHEN ENAME='BLAKE' THEN '5'
    WHEN ENAME='CLARK' THEN '6'
    WHEN ENAME='TURNER' THEN '7'
    WHEN ENAME='MILLER' THEN '8'
    WHEN ENAME='MARTIN' THEN '9'
    WHEN ENAME='WARD' THEN '10'
    WHEN ENAME='ADAMS' THEN '11'
    WHEN ENAME='JAMES' THEN '12'
    WHEN ENAME='SMITH' THEN '13'
    ELSE NULL END;
    END;
    The above code show the following error
    ===========ERROR==========
    ORA-06550: line 3, column 29:
    PL/SQL: ORA-00905: missing keyword
    ORA-06550: line 2, column 2:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 4, column 2:
    PLS-00103: Encountered the symbol "WHEN" when expecting one of the following:
    ( begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    1. BEGIN
    2. UPDATE emp SET SAL = CASE
    3. WHEN ENAME='JONES' THEN '4';
    4. WHEN ENAME='BLAKE' THEN '5'
    5. WHEN ENAME='CLARK' THEN '6'
    Regards
    Balaji
    Edited by: 904493 on Jan 13, 2012 4:18 AM

  • Issue with CAS Console for 3.1.1

    Hi All,
    We are having an issue with the CAS Console in Workbench. We upgraded bot CAS and Tools and Framework to 3.1.1 from the previous versions. We were able to successfully recreate all the crawls and can execute them from the command line. However when opening Workbench and selecting the CAS Console item we don't get anything displayed. The logs show the following:
    2013-01-25 15:55:32,342 WARN [] [1415899750@jetty-7] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://endeca.com/itl/cas/2011-12}CasCrawlerService#{http://endeca.com/itl/cas/2011-12}getAllModuleSpecs has thrown exception, unwinding now
    org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://endeca.com/itl/cas/2010-07}getAllModuleSpecs found. Expected {http://endeca.com/itl/cas/2011-12}getAllModuleSpecs.
    at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:105)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:110)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)
    at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.endeca.itl.plugin.ThreadContextRunner$1$1.doWork(ThreadContextRunner.java:19)
    at com.endeca.itl.plugin.ThreadContextRunner.run(ThreadContextRunner.java:110)
    at com.endeca.itl.plugin.ThreadContextRunner$1.invoke(ThreadContextRunner.java:25)
    at $Proxy10.service(Unknown Source)
    at com.endeca.itl.bootstrap.CasBootStrapServlet.service(CasBootStrapServlet.java:105)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    Anyone seen this?

    Why a home screen? Option to delete

  • CLOB with case statement not working getting error

    Can anyone help on this
    I write this sql
    select Case when to_clob(PROPERTY) = 'is_intradesk=Y' then 'Internal' end
    from JPM_CP;
    Where PROPERTY column is clob column and its giving the error "ORA-00932: inconsistent datatypes: expected - got CLOB"
    Is it not possible to use clob columns with case or decode !

    Its working but it does not fulfill my purpose
    In you answer it is looking for position right! means, does the column contain the value('Intradesk=Y' ) or not. means
    I am looking for exact match with CLOB column values, that is Clob column(PROPERTY) contains the exact value that value which I am comparing with i.e 'Intradesk=Y'
    I need this
    select * from table where clob_column = 'value' (exact).
    Edited by: sajalkdas on Feb 4, 2011 3:28 PM

  • Issue with case statment on particular column

    We have a case statement on a particular column in rpd. Report works fine when this column is not included in the report. Including the column fails to generate the below strange error
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1445, message: ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
    Thanks in Advance
    Surya

    CASE WHEN "INVOICE AND PAYMENTS"."ACCESS LEVEL".ENTITY_CODE = 'SCS' THEN "INVOICE AND PAYMENTS"."CODE COMBINATIONS".SEGMENT2 ELSE "INVOICE AND PAYMENTS"."CODE COMBINATIONS".SEGMENT7 END ..
    There are ten colums in BMM layer, all of them has similar case statements.

Maybe you are looking for

  • Open Items in GR/IR Account

    Hello. I created a PO for $100 with Quantity 1.   Then later a fully received using transaction MIRO.   Finally I enter the Invoice for paid the $100 using as reference the PO. So, there is no pending amount in GR/IR Account. But when a list the Open

  • How to print a post card om HP4640

    Hi, I am trying to print new years card with my HP4640 on 200g' A4 size paper, but the printer wouldn't reconize the paper. Is the paper too big? or it's something i can solve by changing the settings? Thank you, Itamar

  • Restrict system that couldn't do VF11 when AR document have been cleared

    Dear  Experts, My question is as follows. After I  posted the billing document(VF01), it produces an accounting document simultaneously . Then , the financial users use F-30 to collect invoice amount and then the AR item  been cleared. But after clea

  • Need option to list books by File Name

    With a good number of books added to ADE, it's sometimes impossible to identify the book from the thumbnail, if it's just the first page of text, for example, and not all pdfs populate the "Title" field either, especially homegrown pdfs. So if Adobe

  • Time Machine Getting Slower ... and sloowweerr ... and sllooowwe...?

    I'm having a few issues with Time Machine. I've noticed that backups seem to be getting progressively slower. Details are: System:  17" 1.25Ghz iMac – PowerPC – 10.5.8 Data:  Around 140GB total data over two hard drives: 1st Drive: Internal hard disk