Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    36

    Unanswered: Writing a Case Statement

    Hello friends,
    Below is the Business requirement i have to achieve writing a case statement.
    But im not able to write the correct case statements.

    IF PRODUCT_NUMBER IN (323, 324)
    THEN '881'
    ELSE IF PRODUCT_NUMBER < 400
    AND
    SUB_DIVISION_CD IN ('31')
    AND
    SECURITY_METHOD IN('26','28') THEN '630'
    ELSE IF PRODUCT_NUMBER NOT IN (323, 324, 326, 314)
    AND
    SUB_DIVISION_CD = '31'
    AND
    SECURITY_METHOD IN('29','30') THEN '598'
    ELSE
    IF
    PRODUCT_NUMBER < 400
    AND
    SUB_DIVISION_CD IN ('30','33')
    AND
    SECURITY_METHOD IN('26','28') THEN '630'
    ELSE
    IF
    SUB_DIVISION_CD = '31'
    AND
    LOAN_EMPLOYER_CD IN (490, 491)
    AND SECURITY_METHOD ='93' THEN '630'
    ELSE '630'

    Can Somebody please help me in achiving the required result please.
    Thank you in advance.

  2. #2
    Join Date
    Mar 2007
    Posts
    623
    Hello,
    for accuracy, although you talk about CASE statement, that pseudo code pictures CASE expression (as e.g. '810' is not statement). It would be useful if you realized what exactly (and where) you want and used correct terms.

    Syntax of both CASE language elements is described in Oracle documentation books, which are available e.g. online on http://tahiti.oracle.com/
    For 11g, relevant articles are placed here:
    CASE expression: http://docs.oracle.com/cd/E11882_01/...4.htm#i1033392
    CASE statement: http://docs.oracle.com/cd/E11882_01/...ent.htm#i36967
    Just follow the one you actually want to use.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •