Skip to Main Content
  • Questions
  • How Boolean datatype works in PL/SQL

Breadcrumb

May 4th

Question and Answer

Connor McDonald

Thanks for the question, Alok.

Asked: September 20, 2016 - 10:21 am UTC

Last updated: September 29, 2016 - 10:46 am UTC

Version: Oracle 11g

Viewed 1000+ times

You Asked

Hi Tom,

I have doubt regarding one of the scenarios in which boolean is used.
For example,
v_bool boolean:=TRUE;

If I am doing in an expression:

v_bool = TRUE then its fine

but if I am writing

v_bool is TRUE--- its throwing error

Please explain how these two cases are different.

Thanks,
Alok

and Connor said...

"is" is only appropriate for certain options, eg is null, is not null, is a set etc.

But you dont need '=' because it is *already* a boolean.

eg

declare
  x boolean := true;
begin
  if x then     <=====
    ...



Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Nice post

emanuel marui, September 29, 2016 - 7:15 am UTC

I like this post. It is very useful for me. It is giving more information and ideas for my work. I hope you will keep this website updated so users can come and read interesting stories. I am very impressed by the way you share nice and valuable content. Feel free surf ( http://www.essayguardian.com/ )
Connor McDonald
September 29, 2016 - 10:46 am UTC

glad we could help