Link to home
Start Free TrialLog in
Avatar of kmcbrearty
kmcbreartyFlag for United States of America

asked on

ODP.NET Default Column Values

We are trying to migrate from System.Data.OracleClient to the Managed ODP.NET (4.121.1.20131211) data provider.  The main issue that we are having at the moment is we are unable to load the default column values from the database.  With System.Data.OracleClient this happened when calling OracleDataAdapter.FillSchema().  Unfortunately, it doesn't appear that Oracle implemented the logic the same as Microsoft and I can find much information on possible workarounds.

For my purposes I believe that if I manually set the default value on the column that my problem will be solved.  I was considering running the following schema query:

SELECT TABLE_NAME, COLUMN_NAME, DATA_DEFAULT
FROM USER_TAB_COLUMNS 
WHERE data_default IS NOT NULL AND TABLE_NAME = 'MY_TABLE'

Open in new window


My issue is that I am not sure how I can easily take the value that I get from the query and convert it to the value that should be used to set the default column value in all cases.  Can anyone help point me in the right direction?
Avatar of Michael Fowler
Michael Fowler
Flag of Australia image

Just a thought as no one else has jumped in but I have seen this solution where the error is not all variables bound.

You Can Solve Your Problem by calling Stored Procedures this way... "begin yourStoredProce(param);end;"
NOTE:  COMMAND TYPE IS TEXT NOT STORED pROCEDURE
OracleCommand cmd = new OracleCommand("begin U_50004REG_REPORTS.USRUNI114(2612);end;", this.conn);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();

Hope this helps
ASKER CERTIFIED SOLUTION
Avatar of kmcbrearty
kmcbrearty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kmcbrearty

ASKER

I included the information on how the problem was actually solved.