Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

PL/SQL Boolean Examples

Oracle Database Tips by Donald BurlesonJuly 122, 2015

Question:  Can you please show an example of PL/SQL using the BOOLEAN datatype?  I need to see how the BOOLEAN is used in PL/SQL.

Answer:  Invented by George Boole (Boolean Logic), Boolean values are single byte datatypes that correspond to TRUE (1), FALSE (0) or NULL () values. 

For more working examples of Boolean values in PL/SQL see the code depot download in the book Easy Oracle PL/SQL Programming.

Boolean values are great for checking complex evaluations in PL/SQL.

A Boolean function can be wither a one (1) for TRUE and a zero (0) for FALSE:

function false return boolean
is
begin
return 0;
end;

function true return boolean
is
begin
return 1;
end;


Here is an example of a Boolean condition within a PL/SQL function:

create function
   credit_is_good

good_credit BOOLEAN := FALSE
 . . .
Return BOOLEAN
BEGIN
if complex IF/then else test > 500 then good_credit = := TRUE
END;



Here is another example of a Boolean operator in a PL/SQL stored procedure:

PROCEDURE profiler_control(

   start_stop IN VARCHAR2,
   run_comm IN VARCHAR2,
   ret OUT BOOLEAN) AS ret_code INTEGER;

BEGIN
 ret_code:=dbms_profiler.internal_version_check;
  IF ret_code !=0 THEN
   ret:=FALSE;
  ELSIF start_stop NOT IN ('START','STOP') THEN
   ret:=FALSE;
  ELSIF start_stop = 'START' THEN
   ret_code:=DBMS_PROFILER.START_PROFILER(run_comment1=>run_comm);
   IF ret_code=0 THEN
    ret:=TRUE;
   ELSE
    ret:=FALSE;
   END IF;
  ELSIF start_stop = 'STOP' THEN
   ret_code:=DBMS_PROFILER.FLUSH_DATA;
   ret_code:=DBMS_PROFILER.STOP_PROFILER;
   IF ret_code=0 THEN
    ret:=TRUE;
   ELSE
    ret:=FALSE;
   END IF;
  END IF;
END profiler_control;


 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.

 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster