PLSQL Flashcards
(73 cards)
What does PL/SQL stand for?
Procedural SQL
What is a major drawback of SQL?
No procedural capability
What is one advantage of PL/SQL?
Supports SQL data manipulation along with conditional checking
What are the key components of a PL/SQL block?
DECLARE, BEGIN, EXCEPTION, END
Fill in the blank: PL/SQL data types are native to _______’s data dictionary.
Oracle
What does %TYPE do in PL/SQL?
Declares a variable or constant to have the same data type as that of a previously defined variable or a column in the table or view
What is a requirement for naming a variable in PL/SQL?
A variable must begin with a character and can be followed by a maximum of 29 other characters
What is DBMS_OUTPUT?
A package that includes a number of procedures and functions that accumulate information in a buffer
How do you display user messages in PL/SQL?
Using the PUT_LINE procedure
What is the syntax for a simple IF statement in PL/SQL?
if <condition> then <statements>; end if;</statements></condition>
What is the syntax for an ELSE IF ladder in PL/SQL?
if <condition1> then <statements>; elsif <condition2> then <statements>; else <statements>; end if;</statements></statements></condition2></statements></condition1>
What is a simple loop in PL/SQL?
loop <statements> end loop;</statements>
What is the purpose of the EXIT statement in a loop?
To terminate the loop when a certain condition is met
What is the syntax for a WHILE loop in PL/SQL?
while <condition> loop <statements> end loop;</statements></condition>
What is a stored function in PL/SQL?
Logically grouped PL/SQL statements that perform a specific task and return a single value
What are the three parts of a stored function?
Declarative part, executable part, exception handling
What is the purpose of the CREATE OR REPLACE FUNCTION statement?
To define a new stored function or replace an existing one
What is the main difference between functions and procedures in PL/SQL?
Functions explicitly return a single value, while procedures can return multiple values
What is the syntax for creating a stored procedure?
create or replace procedure procedure_name(parameters) is <local> begin <PL/SQL statements>; exception <PL/SQL statements to handle errors> end;</local>
What does the term ‘BULK COLLECT’ refer to in PL/SQL?
A method to fetch multiple rows of data into a collection in a single operation
True or False: Stored functions can use DDL statements.
False
Fill in the blank: To execute a function, use the syntax select _______ from dual;
funname(parameters)
What is the purpose of the procedure ‘proc11’?
To calculate the area of a circle given its radius
The formula used is area = radius * radius * pi, where pi is constant.
What is the constant value of pi used in ‘proc11’?
3.14