Search code examples
sqloracleoracle10goracle-xe

Oracle shows "no data found" when I try to retrieve data from existing column


I have created DriversTable that stores details like Name, Age, Gender etc as shown in the screenshots below.

When I try to retrieve data in a row based on the Availability column that exists in the DriversTable, it says "no data found".

But when I try to retrieve data based on the Gender column, it shows the result as expected

I don't know why this is happening, is it some kind of exception in database or am I doing something wrong ?

Please help

enter image description here

enter image description here

enter image description here


Solution

  • This might be caused by columns having "hidden" characters. Often these are spaces at the end of the value.

    To test this, use LIKE:

    where availability like 'Availability%'
    

    If this occurs, then there are probably spaces (but there could be something else). The most common issue is that a column is declared using CHAR() rather than VARCHAR2().