How can I tell if a field has spaces or nulls?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: How can I tell if a field has spaces or nulls?

  1. #1
    Join Date
    Nov 2000
    Location
    Charlotte
    Posts
    88

    Exclamation

    I have two fields in a table "Item" defined as varchar2(50) and "udc_drp" defined as varchar2(50)

    "Item" field contains the following data:
    "123456789 .......spaces up to 50"

    "udc_drp" field contains the following data:
    "Company ........spaces up to 50"

    When I do a select on the item field my rows are returned. When I do a select on the udc_drp field, no rows are returned. However if I pad the where clause with spaces for the udc_drp field, to equal 50, my rows are returned.

    Why the different? What could be causing the problem?


  2. #2
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    Something is amiss.

    A varchar2 column will not store trailing spaces, even if you enter them. Are you absolutely sure about everything here?

    - Chris

  3. #3
    Join Date
    Nov 2000
    Location
    Charlotte
    Posts
    88
    I'm positive about everything I've written. And I agree, varchar2 does not store spaces. That's why I'm here scratching my head as well.

    I do have a theory but I'm not sure how I can check it. I have access to the input text file. What if the file that is being generated is putting something other than spaces in that field? Is there a way to check the hex characters of a text file (other than on the mainframe)?

    I see a drop & recreation of the table as well as a recreation of the input file coming. The DBA manager won't like it, but he'll have to get over it. :-)

    I'm getting desperate.

  4. #4
    Join Date
    Jun 2000
    Location
    Conway,AR,USA
    Posts
    29
    Use the length function to find it
    Soumya
    still learning

  5. #5
    Join Date
    Nov 2000
    Location
    Charlotte
    Posts
    88

    Talking

    Thanks all,

    The length function works like a charm. Now I have proof that the input file is incorrect.

    (And I'm not crazy :-)

    -- Charles

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