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
At times, customers make mistakes in submitting their orders and call to cancel the order. Brewbean’s wants to create a trigger that automatically updates the stock level of all pr

Using FORALL and BULK COLLECT Together You can unite the BULK COLLECT clause with the FORALL statement, in that case, the SQL engine bulk-binds column values incrementally. In

Using NOT NULL Besides assigning an initial value, the declarations can impose the NOT NULL constraint, as the example below shows: acct_id INTEGER(4) NOT NULL := 9999; You ca

Product-specific Packages The Oracle and different Oracle tools are supplied with the product-specific packages which help you to build the PL/SQL-based applications. For illus

Existential Quantification - SQL Existential quantification-stating that something is true of at least one object under consideration-can be expressed by OR(r,c), meaning tha

Using EXTEND To enlarge the size of a collection, use EXTEND. This process has 3 forms. The EXTEND appends one null element to a collection. And the EXTEND(n) appends n null e

Assigning and Comparing Collections One collection can be assigned to other by an SELECT, INSERT, UPDATE, or FETCH statement, an assignment statement, or by a subprogram call. A

Initializing Objects: Till you initialize an object by calling the constructor for its object type, the object is automatically null. That is, the object itself is null, not me

Effects of NULL for union - SQL The treatment of NULL in invocations of EXCEPT is as for UNION. This is different from its treatment in those of NOT IN and quantified compari

DBMS_OUTPUT: The Package DBMS_OUTPUT enables you to display output from the PL/SQL subprograms and blocks, that makes it easier to test and debug them. The procedure put_ line