One of the major differences between PL/SQL code written in Oracle Forms applications and the one written in the Java Programming language is how they handle null values. Java makes different assumptions about null values and operations between them and actual values. In some cases the terrifying ‘java.lang.NullPointerException’ will be thrown. Oracle Forms is different and lets you play freely with null values and there are some rules when you work with them. For Example if you have an expression:
You will get: ‘eric’
And let’s say that you migrated that piece of code to java:
You will get: ‘nulleric’. As you can see, it is not what the owner of the original forms wants the java code to do after migration. To handle that in pure java code you will have to do something like handling the null value first and then perform the calculation, but that will probably enlarge your java code. Another solution is to initialize all String values with an empty space, but that will probably bring some other issues like null comparisons. For example ‘ if value is null’ will not be true if you have initialize your variable with an empty string value.
Null values are an important issue to consider when migrating to Java. In my next blog I will talk about operations between different data types.