Skip to Main Content
  • Questions
  • Data Loading with APEX - How to avoid upload of null values

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Angelo.

Asked: November 11, 2016 - 7:29 pm UTC

Last updated: November 14, 2016 - 3:27 am UTC

Version: APEX 5.0.4

Viewed 1000+ times

You Asked

Hi guys,
I'm developing an application wich has a data loading wizard section.
Users can upload several CSV files where some of the columns values are checked against a reference (I used Table Lookup for that).
Problem is that I just realized that null values are not flagged as errors for some reason.
Is there some way to do that? I would like not to set to the underlying table columns a not-null constraint.

Thanks
A

and Connor said...

"I would like not to set to the underlying table columns a not-null constraint."

Doesnt that suggest you are happy to accept null values ? Because surely you end up with the unenviable situation of: "If you use the wizard you cannot load nulls, but if you use some other means you *can* load nulls"

That seems a bad idea to me. But if you truly need that kind of function, then maybe do something like this:

- create a global context
- add a "partially" null constraint to the table, ie

check ( sys_context('MY_CONTEXT','NULLS_ALLOWED') = 'YES' or col is not null)

- have Apex set the context before the data load takes place.

But its not something I'm a fan of.

Is this answer out of date? If it is, please let us know via a Comment