1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Hi, i have a simple question with respect to nvl

Discussion in 'SQL PL/SQL' started by Shanmugapriya, Jun 15, 2016.

  1. Shanmugapriya

    Shanmugapriya Active Member

    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    130
    Location:
    Bangalore
    I am trying to return values of the column where it is NULL. I tried to use below query, but it is not returning any value. The column "i1527_alias_premname_indicator" is of datatype CHAR(1). Kindly help

    select nvl(i1527_alias_premname_indicator, 'n') as output
    from premises_name_b
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,517
    Likes Received:
    360
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    How many rows are in this table? What values are in the 'problem' column? You can't expect us to know your data if you don't tell us about it.
     
  3. Shanmugapriya

    Shanmugapriya Active Member

    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    130
    Location:
    Bangalore
    Hi,
    It has values 'Y' , 'N', and NULL's.
     
  4. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    715
    Likes Received:
    143
    Trophy Points:
    830
    Location:
    Russian Federation
    If NULL value has to be replaced with value N and processing for a line (you have to have where condition), then a simple example:
    Code (SQL):
    SELECT NVL(i1527_alias_premname_indicator, 'N') AS output
    FROM premises_name_b
     
    or
    Code (SQL):
    SELECT COALESCE(i1527_alias_premname_indicator, 'N') AS output
    FROM premises_name_b
     
     
  5. Shanmugapriya

    Shanmugapriya Active Member

    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    130
    Location:
    Bangalore
    I tried the same, which didn't work yesterday. It is working now. Thank you very much for your help :)
     
  6. Siddhartha

    Siddhartha Active Member

    Messages:
    16
    Likes Received:
    2
    Trophy Points:
    90
    Location:
    Bangalore
    select nvl(i1527_alias_premname_indicator, 'n') as output from premises_name_b.....