I am trying to create a C# data generator for oracle database. Though I have run into some problems. I am getting ORA-26010 error message which is:
A column which is NOT NULL in the database is not being loaded and will cause every row to be rejected.
I didn't have that problem with previous tables and spend hours already to find solution.
This is how it looks in the code:
private static DataTable BuildMagazynTable(int b)
{
var magazynTable = new DataTable();
magazynTable.Columns.Add("ID");
magazynTable.Columns.Add("NAZWA_MAGAZYNU");
magazynTable.Columns.Add("MIASTO");
magazynTable.Columns.Add("ULICA");
magazynTable.Columns.Add("NR_LOKALU");
for (int i = 1; i <= b; i++)
{
var ar = magazynTable.NewRow();
ar["ID"] = null;
ar["NAZWA_MAGAZYNU"] = "Nazwa Magazynu" + i;
ar["MIASTO"] = "Miasto" + i;
ar["ULICA"] = "Ulica" + i;
ar["NR_LOKALU"] = "Nr lokalu" + i;
magazynTable.Rows.Add(ar);
}
return magazynTable;
}
And there is how I created the table in oracle database:
CREATE TABLE magazyn (
id NUMBER GENERATED by default on null as IDENTITY,
Nazwa_magazynu VARCHAR2(15) NOT NULL,
miasto VARCHAR2(15) NOT NULL,
ulica VARCHAR2(15) NOT NULL,
Nr_lokalu VARCHAR2(15) NOT NULL);
ALTER TABLE magazyn ADD CONSTRAINT magazyn_pk PRIMARY KEY ( id );
And there is screen from SQL Developer:

I am using Oracle.ManagedDataAccess with bulkcopy to send data to database.