开发者

How to Get non nullable Columns of a Table using java?

开发者 https://www.devze.com 2023-01-30 13:01 出处:网络
I am trying to get the non-nullable columns of a table thro开发者_StackOverflowugh a java code.... Can anyone help me?It is not completely clear what you are asking. Do you want to find out, from your

I am trying to get the non-nullable columns of a table thro开发者_StackOverflowugh a java code.... Can anyone help me?


It is not completely clear what you are asking. Do you want to find out, from your Java program, which columns of a specific table are not nullable?

You can call java.sql.DatabaseMetaData.getColumns() to get information about the columns of a table. One of the items that you'll get back is IS_NULLABLE, which indicates if the column is nullable. See the API documentation of the getColumns method for detailed information.


not a Java answer, but you can query for it!

select 
     table_name, 
     columns_name, 
     data_type, 
     nullable 
  from ALL_TAB_COLUMNS

supply the table_name and filter on nullable

0

精彩评论

暂无评论...
验证码 换一张
取 消