Create a view on emp table named general 2 Use select from clause to do

Create a view on emp table named general 2 use select

This preview shows page 35 - 40 out of 84 pages.

1. Create a view on emp table named general 2. Use select from clause to do vertical partioning Q3: Display all the views generated. ------------------------------ ------- ---------- DEPT TABLE EMP TABLE EMPVIEW VIEW EMPVIEW1 VIEW Q4: Execute the DML commands on the view created. Ans: QUESTIONS AND ANSWERS 1.What is a view? 2.List any two advantages of view?
Image of page 35
U Janardhan Reddy IT / IV Sem DBMS Lab - LM Exercise Number:10 Title of the Exercise : CONTROL STRUCTURE Date of the Exercise : OBJECTIVE (AIM) OF THE EXPERIMENT To create PL/SQL programs to implement various types of control structure. a) PL/SQL Syntax: PL/SQL can also process data using flow of statements. The flow of control statements are classified into the following categories. Conditional control –Branching Iterative control – looping Sequential control - Selection BRANCHING in PL/SQL: Sequence of statements can be executed on satisfying certain condition. If statements are being used and different forms of if are: 1. Simple IF 2. If then else 3. Else if 4. Nested if SELECTION IN PL/SQL (Sequential Controls) 1. Simple case 2. Searched case ITERATIONS IN PL/SQL Sequence of statements can be executed any number of times using loop construct. It is broadly classified into: 1. Simple Loop 2. For Loop 3. While Loop SIMPLE IF: Syntax: IF condition THEN statement1; statement2; END IF; IF-THEN-ELSE STATEMENT: Syntax: IF condition THEN statement1; ELSE statement2; END IF; ELSIF STATEMENTS: Syntax: IF condition1 THEN statement1; ELSIF condition2 THEN statement2; ELSIF condition3 THEN statement3; ELSE
Image of page 36
U Janardhan Reddy IT / IV Sem DBMS Lab - LM NESTED IF: statement; END IF; Syntax: IF condition THEN statement1; ELSE IF condition THEN statement2; ELSE statement3; END IF; END IF; ELSE statement3; END IF; SELECTION IN PL/SQL (Sequential Controls) SIMPLE CASE Syntax: CASE SELECTOR WHEN Expr1 THEN statement1; WHEN Expr2 THEN statement2; : ELSE Statement n; END CASE; SEARCHED CASE: Syntax: CASE WHEN searchcondition1 THEN statement1; WHEN searchcondition2 THEN statement2; :: ELSE statementn; END CASE; ITERATIONS IN PL/SQL SIMPLE LOOP Syntax: LOOP statement1; EXIT [ WHEN Condition]; END LOOP; Example: Declare A number:=10; Begin Loop a := a+25; exit when a=250; end loop; dbms_output.put_line(to_char(a)); end;
Image of page 37
U Janardhan Reddy IT / IV Sem DBMS Lab - LM /
Image of page 38
WHILE LOOP Syntax WHILE condition LOOP statement1; statement2; END LOOP; Example: Declare i number:=0; j number:=0; begin while i<=100 Loop j := j+i; i := i+2; end loop; dbms_output.put_line(‘the value of j is’ ||
Image of page 39
Image of page 40

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture