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

Thread: SQL Help

  1. #1
    Join Date
    Jul 2001
    Posts
    334

    SQL Help

    Hi All,

    I have column name credit_card_number (It could be 16 or 15 digits long, depends on the credit card type). I would like to display 1st and last 4 digits only and the remaining should display in *****
    e.g
    5567989754541236 (cc number)
    5**********1236 (This how I want)

    Thanks in advance.

    Thanks.

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492

    Talking



    Try:

    Code:
               SUBSTR(credit_card_number,1,1)
             ||LPAD('*',LENGTH(credit_card_number)-5,'*')
             ||SUBSTR(credit_card_number,-4)

    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

  3. #3
    Join Date
    Jul 2001
    Posts
    334
    Thanks for your quick response!!

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