Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Pl/sql Conditional Control: IF statementsFrequently, it is necessary to take the alternative actions depending on the circumstances. The IF statement execute a series of statements conditionally. That is, whether the series is executed or not depends on the value of the condition. There are 3 forms of IF statements: IF-THEN, IF-THEN-ELSE, & IF-THEN-ELSIF.IF-THENThe simplest form of the IF statement acquaintances a condition with a series of statements enclosed by the keywords THEN and END IF (not ENDIF), as shown below:IF condition THENsequence_of_statementsEND IF;The series of statements is executed only if the condition is true. When the condition is false or null, then the IF statement can do nothing. In either of the case, the control passes to the next statement. An illustration is shown below:IF sales > quota THENcompute_bonus(empid);UPDATE payroll SET pay = pay + bonus WHERE empno = emp_id;END IF;You may want to place brief IF statements on a single line, as inIF x > y THEN high := x; END IF;IF-THEN-ELSEThe IF statement that is the second form adds the keyword ELSE follow by an alternative series of statements is as shown below:IF condition THENsequence_of_statements1ELSEsequence_of_statements2END IF;The series of statements in the ELSE clause is executed only if the condition is false or null. Therefore, the ELSE clause ensure that a sequence of statements is executed. In the example below, the first UPDATE statement is executed if the condition is true, while the second UPDATE statement is executed if the condition is false or null:IF trans_type = ’CR’ THENUPDATE accounts SET balance = balance + credit WHERE...ELSEUPDATE accounts SET balance = balance - debit WHERE...END IF;The THEN and ELSE clauses can involve the IF statements. That is, the IF statements can be nested, as the example below shows:IF trans_type = ’CR’ THENUPDATE accounts SET balance = balance + credit WHERE...ELSEIF new_balance >= minimum_balance THENUPDATE accounts SET balance = balance - debit WHERE ...ELSERAISE insufficient_funds;END IF;END IF;IF-THEN-ELSIFAt many times you want to select an action from some mutually exclusive alternatives. The third form of the IF statement uses the keyword ELSIF to introduce the additional conditions which is as shown below:IF condition1 THENsequence_of_statements1ELSIF condition2 THENsequence_of_statements2ELSEsequence_of_statements3END IF;When the first condition is false or null, then the ELSIF clause tests another condition. An IF statement can have a few number of ELSIF clauses; the final ELSE clause is elective. The Conditions are evaluated one by one from top to bottom. When any condition is true, its related sequence of statements is executed and the control passes to the next statement. If all the conditions are false or null, then the sequence in the ELSE clause is executed. Consider the following illustration as shown below:BEGIN...IF sales > 50000 THENbonus := 1500;ELSIF sales > 35000 THENbonus := 500;ELSEbonus := 100;END IF;INSERT INTO payroll VALUES (emp_id, bonus, ...);END;When the value of sales is bigger than 50000, the first and second conditions are true.However, bonus is assigned the proper value of 1500 as the second condition is never tested. When the first condition is true, its related statement is executed and the control passes to the INSERT statement.
Structure of an Object Type: Similar to package, an object type has 2 parts: the specification and the body. The specification is the interface to your applications; it declar
3CX PBX sync Windows Service Project Description: !! You require access to a commercial version of the 3CX PBX system in order to be able to program the API !! !! You requ
Example of Cast Operator So long as CAST is used as shown, we could obtain the total marks for each exam in similar fashion, using SUM (Mark) AS TotalMarks. However, this giv
SQL Cursor The Oracle implicitly opens a cursor to process each SQL statement not related with an explicit cursor. The PL/SQL refers to the most current implicit cursor as t
Using Invoker Rights: By default, the stored procedure executes with the privileges of its definer, not its invoker. These procedures are bound to the schema in which they inh
Hi,am developing a library system and relating all the table is somehow complex,could you kindly assist me
LEVEL You use the LEVEL with the SELECT CONNECT BY statement to categorize rows from a database table into a tree structure. The LEVEL returns the level number of a node in a
ALTER TABLE bb_basketitem ADD CONSTRAINT bitems_qty_ck CHECK (quantity BEGIN INSERT INTO bb_basketitem VALUES (88,8,10.8,21,16,2,3); END; Brewbean’s wants to add a check
EXIT Statement You can use the EXIT statement to exit a loop. The EXIT statement has 2 forms: the conditional EXIT WHEN and the unconditional EXIT. With the either form, you
IN Mode An IN parameter pass the values to the subprogram being called. Within the subprogram, an IN parameter acts like a constant. And hence, it cannot be assigned a value.
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd