Results 1 to 2 of 2

Thread: Problem using SQL case statement - oracle

  1. #1
    Member
    Join Date
    Sep 2012
    Posts
    90

    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
    Member
    Join Date
    Jul 2012
    Posts
    46
    Use a replace function instead of the case statement.

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. CASE Statement example in oracle plsql
    By Oracleguy in forum Oracle
    Replies: 0
    Last Post: 10-31-2012, 10:07 AM
  2. 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
  •