Results 1 to 2 of 2

Thread: Problem using SQL case statement - oracle

  1. #1
    Member
    Join Date
    Sep 2012
    Posts
    1,147

    Lightbulb Problem using SQL case statement - oracle

    I am new to oracle sql. The data in one of the columns is

    Code:
    1.2.10.00.12
    When i find "0.00.", i want to replace it with hyphen(-). The output should be

    Code:
    1.2.1-12
    I tried the following case statement:

    Code:
    case column when '0.00.' then - else column end alias_name
    I am not getting the required output. Please help me in this.

  2. #2
    Senior Member
    Join Date
    Jul 2012
    Posts
    9,625
    Use a replace function instead of the case statement.

    Code:
    select replace('1.2.10.00.12','0.00.','-') from dual

Similar Threads

  1. SQL Case Statement Setting as NULL for Some
    By Oracleguy in forum Oracle
    Replies: 0
    Last Post: 12-23-2012, 03:11 AM
  2. Replies: 0
    Last Post: 12-21-2012, 02:01 PM
  3. CASE Statement example in oracle plsql
    By Oracleguy in forum Oracle
    Replies: 0
    Last Post: 10-31-2012, 10:07 AM
  4. Replies: 0
    Last Post: 06-27-2012, 12:58 PM

Bookmarks

Posting Permissions

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