Operator precedence-pl/sql expressions , PL-SQL Programming

Operator Precedence

The operations within an expression are completed in a particular order depending on their precedence (priority). The table shows the default order of the operations from first to last (from top to bottom).

1559_Operator Precedence.jpg

 

Table: Order of Operations


The Operators with higher precedence are applied first. In the illustration below, both the expressions yield 8 as the division has a higher precedence than addition. The Operators with similar precedence are applied in no particular order.


5 + 12 / 4
12 / 4 + 5

You can use the parentheses to control the order of the evaluation. For illustration, the expression below yields 7, not 11, as the parentheses override the default operator precedence:

(8 + 6) / 2


In the later example, the subtraction is completed before the division as the most deeply nested sub expression is always checked first:

100 + (20 / 5 + (7 - 3))

Posted Date: 10/3/2012 5:12:18 AM | Location : United States







Related Discussions:- Operator precedence-pl/sql expressions , Assignment Help, Ask Question on Operator precedence-pl/sql expressions , Get Answer, Expert's Help, Operator precedence-pl/sql expressions Discussions

Write discussion on Operator precedence-pl/sql expressions
Your posts are moderated
Related Questions
Example of Shorthand for a row constraint Example: Shorthand for a row constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Mark_in_range CHECK (Mark BETWEEN 0 AND 100);

Extension and AND in SQL The theory book gives the following simple example of relational extension in Tutorial D: EXTEND IS_CALLED ADD ( FirstLetter ( Name ) AS Initial )

%ROWTYPE: This attribute gives a record type which represents a row in the database table or a row fetched from a formerly declared cursor. The Fields in the record and corresp

SELECT a.child_fname,a.child_lname,concat(b.parent_title,b.parent_fname), b.parent_lname,b.parent_tphone FROM child a,parent b WHERE a.parent_id=b.parent_id ORDER BY a.child_fnam

This is a Customer Management project. Customer data is presented in a text file. The program will load this text data into its DB columns. The data mapping is user definable. User

Advantages of Invoker Rights The Invoker-rights routines centralize the data retrieval. They are particularly helpful in applications which store data in various schemas. In su

Calling Constructors: The Calls to a constructor are allowed wherever the function calls are allowed. Similarly to the functions, a constructor is called as a section of an ex

Cursor FOR Loops In most cases that need an explicit cursor, you can simplify the coding by using a cursor FOR loop rather of the OPEN, FETCH, and CLOSE statements. A cursor FO

Quantification in SQL To quantify something, as the theory book has it, is to state its quantity, to say how many of it there are. For example, in Tutorial D the expression CO

Iteration Schemes The bounds of a loop range can be variables, literals, variables, or expressions but must compute to integers. Below are some of the examples. As you can see t