CONVERTING PLSQL TO TSQL

  • converT this PLSQL TO TSQL

    help

    CUSTOMER# - DECODE(Transaction Type Code,'FULL RETIREMENT',3,'PARTIAL RETIREMENT',DECODE(SAME_YEAR,'Y',3),'ADDITION',DECODE(SAME_YEAR,'Y',( DECODE(TO_NUMBER(SUBSTR(Date Entered,-2))-( TO_NUMBER(SUBSTR(Date Placed In Service,-2)) ),0,1,4) )),'ADJUSTMENT',DECODE(SAME_YEAR,'Y',( DECODE(( TO_NUMBER(SUBSTR(Date Entered,-2))-Add Year-TO_NUMBER(SUBSTR(Date Placed In Service,-2)) )+TO_NUMBER(SUBSTR(:Date,-2)),0,1,1,4,2) )))

  • DECODE should be converted to CASE statement(s).

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply