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 


 

 

 


 

 

   

 

  Oracle Tips by Burleson

Conditional Statements

An important aspect of programming is being able to determine if a condition is true or false and then perform specific actions depending upon the outcome of the condition test. Shell scripting supplies several ways of testing conditions and then performing specific actions. Some examples of condition statements are the if condition, the test or expression statement, the while loop, the until loop, and the case statement.

The If condition

The simple form of the if statement consists of the if condition, a then statement followed by commands to be executed when the if condition is true, and the fi statement (if spelled backward) which ends the if statement. The condition usually consists of a simple comparison between two values, such as A=B or number=5.

A simple if conditional statement

$ x=3

$ y=9

$ if [ $x -lt $y ]

> then

> echo " "

> echo " x=${x} which is less than y=${y}"

> echo " "

> fi

x=3 which is less than y=9


The simple if statement also provides an else clause which allows the execution of commands when the condition is false.

A simple if-then-else statement

$ x=3

$ y=2

$ if [ $x -lt $y ]

> then

> echo " "

> echo " ${x} is less than ${y}"

> echo " "

> else

> echo " "

> echo " ${x} is not less than ${y}"

> echo " "

> fi

3 is not less than 2

$


It is also possible to create compound conditional statements by using one or more elif (else if) clauses. If the first condition is false then subsequent elif statements are checked. When an elif condition is found to be true then the statements following the associated then statement are executed.
 

The above book excerpt is from:

Easy Linux Commands
Working Examples of Linux Command Syntax

ISBN: 0-9759135-0-6   

Terry Clark 

http://www.rampant-books.com/book_2005_1_linux_commands.htm 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

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 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational