Check if is column nullable in Oracle database

Query below checks nullability attribute for the column of tables and views in specified schema.

Query

select 
   table_name, 
   column_name, 
   case nullable 
        when 'N' then 'not nullable'
        when 'Y' then 'is nullable'
    end as nullable    
from all_tab_columns
where owner = 'PUT SCHEMA NAME HERE'
order by table_name, column_name;

Columns

  • table_name - name of table
  • column_name - column name
  • nullable - nullability attribute for the column:
    • is nullable - is nullable
    • not nullable - is not nullable

Rows

  • One row represents one column in the schema
  • Scope of rows: all columns in the schema
  • Ordered by table name, column name

Sample results