Professional Documents
Culture Documents
Unit 10 PL/SQL Concepts: Nested If-Else
Unit 10 PL/SQL Concepts: Nested If-Else
PL/SQL Concepts
Nested if-else
Switch Case
Function
Function to check whether the given three sides form a triangle or not:
declare
a number := &a;
b number := &b;
c number := &c;
answer varchar(5);
begin
answer := is_triangle(a, b, c);
if answer = 'True' then
dbms_output.put_line('a = ' || a || 'b = ' || b || 'and c = ' || c|| ' form a triangle');
else
dbms_output.put_line('a = ' || a || 'b = ' || b || 'and c = ' || c|| ' do not form a triangle');
end if;
end;
/
Procedure
PL/SQL procedure to print number of projects assigned to an employee, find the department of
an employee and print the first name and last name of an employee given his/her employee id:
begin
group by employeeid;
end;
Cursor:
1. %found: Is true if query executes on one or more rows and false otherwise.
2. %notfound: Is false if query execute on one or more rows and true otherwise.
3. %rowcount: Counts the number of rows affected by the query.
4. %isopen: Is true if the cursor is open and false otherwise.
Implicit Cursor
Consider the following employee table:
Cursor:
Explicit Cursor:
Trigger