KFSCKFSCNTRB-1781: Changing the sql query to be both Oracle and MySql friendly.

KFSCNTRB-1781: Testing the periodCode with String.Utils.isBlank instead of isEmpty
KFSCNTRB-1781: Changing the sql query to be both Oracle and MySQL friendly