In my code I need to compare 2 variables. One variable is of int data type & another is of varchar2 data type.
In order to compare I am using the below code:
intVariable == atoi(varcharVariable.arr)
The issue is that when the corresponding varchar variable is blank then atoi returns 0 which conflicts with my business logic.
Solution: to alter the condition as below:
intVariable == atoi(varcharVariable.arr) && strlen(varcharVariable.arr) != 0
Please advise if there is any better/alternate way. Thanks in advance.
Best way:
intVariable == atoi(varcharVariable.arr) && varcharVariable.arr[0] != 0x00
Best Way:
intVariable == atoi(varcharVariable.arr) && varcharVariable.arr[0] != 0x00