DATABASE Flashcards
The ______ is a Boolean attribute that evaluates to True if the most recent SQL statement returned at least one row.
SQL%FOUND
The use of INTO clause in PL/SQL select statement is to specify the name of ________.
VARIABLES
What could be the possible error of the given code below?
DECLARE
v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary
FROM employees where employee_id = 100;
DBMS_OUTPUT.PUT_LINE(‘ Salary is : ‘ || v_salary);
END;
NO ERROR
What is the output of the given code below?
DECLARE
v_deptno copy_emp.department_id%TYPE := 50;
BEGIN
DELETE FROM copy_emp
WHERE department_id = v_deptno;
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ‘ rows deleted.’);
END;
Print the number of rows deleted
Which DML statement make changes to the database?
All the options (INSERT, UPDATE, DELETE)
The _____ statement selects rows from one table to update and/or insert into another table.
MERGE
The _____ is an integer value that represents the number of rows affected by the most recent SQL statement.
SQL%ROWCOUNT
The INTO clause occurs between the SELECT and _______ clauses.
FROM
The _________ SQL Rule: queries must return only one row.
EMBEDDED
The DDL and _______ SQL statements cannot be used directly in PL/SQL.
DCL
What could be the possible error of the given code below?
DECLARE
v_sum_sal NUMBER(10,2);
v_deptno NUMBER NOT NULL := 60;
BEGIN
SELECT SUM(salary) FROM employees WHERE department_id = v_deptno;
DBMS_OUTPUT.PUT_LINE(‘Dep #60 Salary Total: ‘ || v_sum_sal);
END;
Missing INTO clause
The code below must print the number of rows updated, what is the missing part of the code?
Declare
v_cal_increase employees.salary%type := 800;
begin
update copy_emp
set salary = salary + v_sal_increase
where job_id = ‘ST_CLERK’;
dbms_output.put_line(_____________ || ‘ rows updated.’);
end;
SQL%ROWCOUNT
The ______ are automatically declared variables that allow you to evaluate what happened when a cursor was last used.
Cursor attributes