Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Location
    Pittsburgh, PA
    Posts
    10

    Question Unanswered: NVL on comma delimited db field

    I have a field in my table called hierarchy. For id of 1 for example,

    the hierarchy field contains chocolate,vanilla


    In my procedure I then want to do the following

    Select NVL(hierarchy) from table

    so that it equates to Select NVL(chocolate, vanilla) from table.

    What am I doing wrong? Thanks

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >In my procedure I then want to do the following
    >Select NVL(hierarchy) from table
    >so that it equates to Select NVL(chocolate, vanilla) from table.
    >What am I doing wrong? Thanks

    Not providing valid SQL syntax.

    If you want "Select NVL(chocolate, vanilla) from table" results, then that is the SQL statement you must execute.

    Also SQL above is not valid as it is missing single quote marks around string items.

    By The Way, It is a bad idea to store multiple values in a single field using any flavour of separator.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by Bozo34 View Post
    the hierarchy field contains chocolate,vanilla
    The hierarchy field contains 'chocolate,vanilla'.

    Quote Originally Posted by Bozo34 View Post

    What am I doing wrong?
    I think you are confusing column names and character strings stored in those columns.
    ---
    "It does not work" is not a valid problem statement.

  4. #4
    Join Date
    Aug 2009
    Posts
    262
    I have a field in my table called hierarchy. For id of 1 for example,
    the hierarchy field contains chocolate,vanilla
    In my procedure I then want to do the following
    Select NVL(hierarchy) from table
    so that it equates to Select NVL(chocolate, vanilla) from table.
    What am I doing wrong? Thanks
    let me simplify for my own brain .

    I have a field in my table called hierarchy
    table x
    column ID
    column HIERARCHY

    the hierarchy field contains chocolate,vanilla
    id hierarchy
    1 chocolate valina

    or
    id hierarchy
    1 chocolate [or can be vanila]

    Select NVL(hierarchy) from table
    so that it equates to Select NVL(chocolate, vanilla) from table.
    nvl ( chocolate, vanila) tells if chocolate is null then it must be vanilla ?

    YOU HAVE WASTED GOOD 3 Min of my time uptill now
    see below and to heaven i care if it doesnt make any sense to you .

    declare
    a <datatype> angry:='chocolate'
    b <datatype> angry:='vanilla'
    begin
    cursor
    ....................
    if a is not null
    then
    select b

    end if
    end


    here i wasted 6min of my worthless time on you


    (here are respected masters of oracle which may help you if they feel fit deem of doing so . )

    else i rate this question absurd

Posting Permissions

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