Vicky3D Vicky3D - 2 months ago 27
Java Question

ResultSetMetaData getting default value of column

I am Using Oracle database.

I want to get default value assign to column using Java JDBC.

But using

ResultSetMetaData
does not provide any method to get default value of column.

So please tell me any idea.
Thanks in advance.

Answer

You can run this query

Select DATA_DEFAULT from USER_TAB_COLUMNS where TABLE_NAME ='MyTable' and COLUMN_NAME = 'MyColumn'