0

I would like to know how Oracle db stores a null. First when using jdbc to fetch a value from a table and it has a null i.e the absence of a value. The jdbc method getInt() returns a zero for the value. What i need to know, is there a way to use maybe getByte instead to check if the value represents a null. I have had no success searching online either at oracle or in general on the web for an answer.

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
  • 5
    This has nothing to do with how NULL is stored. You're supposed to check whether a field is NULL before calling `getInt()`. As the duplicate question shows, `getInt()` returns `0` if there's a `NULL`. The only other option would be to throw an exception – Panagiotis Kanavos Jul 14 '20 at 15:23
  • @PanagiotisKanavos You are supposed to check if a field is `null` **after** (not before) calling `getInt()` (using `wasNull()`). If you'd check before calling `getInt()`, `wasNull()` would reflect the null status of the previous field retrieved. – Mark Rotteveel Jul 14 '20 at 17:09

0 Answers0