Skip to content
Advertisement

To check whether entered number is odd or even in PL/SQL [closed]

I am trying to check whether an entered number is odd or even I am getting an error

enter image description here

Advertisement

Answer

The documentation for the modulo function is here which tells you the syntax is MOD(n1, n2) and not n1 MOD n2 and you are missing the BEGIN statement:

You want:

You can simplify it by removing the intermediate variable and just using the bind variable throughout and can remove the IF statement and multiple output statements and use a single CASE (and handle NULL values):

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement