DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Decode Statement

Hybrid View

  1. #1
    Join Date
    Feb 2000
    Posts
    175
    Hi Folks,

    I'm using 8.1.6 on AIX.

    I'm trying to decode a value that contains a '&' and replace it with another field (See below). However when I run the statement it prompts me for a value for Gen. It thinks the '&' is for user input. Does anybody know how to accept the 'Bill & Ben' and not to prompt for an input for Ben????

    (decode(avc_element_1,
    'Bill & Ben ', ytd_avc_ded_cash_1, 0))


    thanks for any help

    Moff.

  2. #2
    Join Date
    Feb 2002
    Posts
    13

    If SQL*Plus

    If you are running under SQL*Plus you can use the set escape
    command, such as:

    set escape \

    select (decode(avc_element_1,
    'Bill \& Ben ', ytd_avc_ded_cash_1, 0))
    ...

    Hope this helps

  3. #3
    Join Date
    Feb 2000
    Posts
    175
    WROOS,

    Many thanks for your help. It works a treat......


    I also found while looking through the docs that you can turn of the substitution by entering

    Set define off;

    Once again many thanks for your help

    Moff.

Posting Permissions

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


Click Here to Expand Forum to Full Width