Chapter 5 - Market Segmenting, Targeting, and Positioning Flashcards
What is the basic syntax of a block?
DECLARE
BEGIN
EXCEPTION
END
What are ‘Anonymous Blocks’?
When you click the run button you get ‘compile runs’
What are ‘Named Block’?
When you click the run button you get ‘compiles’
P code is generated
How would you declare a variable v_foo and assign it the value of 7?
v_foo NUMBER := 7;
How would you assign the count of teachers in the COSC department from the teachers table?
SELECT COUNT(dept)
INTO v_count
FROM teachers
WHERE dept = ‘COSC’;
Write this as a PL/SQL
If(grade>90) {
System.out.println(“A”);
} else if (grade>80) {
System.out.println(“B”);
} else {
System.out.println(“Fail”);
}
IF v_grade > 90 THEN
dbms_output.put_line(‘A’);
ELSIF v_grade > 80 THEN
dbms_output.put_line(‘B’);
ELSE
dbmd_output.put_line(‘Fail’);
END IF;
Write this as a PL/SQL
while (i < 5) {
System.out.println(i);
i++;
}
WHILE i < 5 LOOP
dbms_output.put_line(i);
i := i + 1;
END LOOP;
Declare variable v_name to be the same variable type as name from the WEEK4_Employees table
v_name WEEK4_Employees.name%TYPE;
Print out “Hello World”
Include line needed to print lines
SET SERVEROUTPUT ON;
dbms_output.put_line(‘Hello World’);