Question:- What do you know about the Commands COMMIT, ROLLBACK, and SAVEPOINT?
Answer:- COMMIT: The COMMIT command saves changes to a database permanently during the current transaction. ROLLBACK: The ROLLBACK command is used at the end of a transaction to undo any modifications made since the start of the transaction. SAVEPOINT: The SAVEPOINT command saves the current point with a unique name during the processing of a transaction.
Question:- What are the Benefits of PL/SQL Packages?
Answer:- PL/SQL packages provide several benefits. Some of them are as follows: • Enforced Information Hiding: It offers the liberty to choose whether to keep the data private or public. • Top-down Design: We can design the interface to the code hidden in the package before we actually implement the modules. • Object Persistence: Objects declared in a package specification behave like global data for all PL/SQL objects in the application. We can modify the package in one module and then reference those changes in another • Object-oriented Design: The package gives developers a stronghold over how the modules and data structures inside the package can be used. • Guaranteeing Transaction Integrity: It provides a certain level of transaction integrity. • Performance Improvement: The RDBMS automatically tracks the validity of all program objects stored in the database. It also enhances the performance of packages.
Question:- What is Exception Handling?
Answer:- Exception handling is a mechanism that is implemented to deal with runtime errors. It can be adjusted in PL/SQL. PL/SQL provides the exception block that raises the exception, thus helping the programmer to find the fault and resolve it. When an error occurs, the program’s error handling code is included. There are two different types of exceptions defined in PL/SQL: • User-defined exception • System-defined exception
Question:- Mention a Few Predefined Exceptions
Answer:- The following are some examples of predefined exceptions: • NO DATA FOUND: A single-row SELECT statement that returns no data • TOO MANY ROWS: A single row SELECT statement that returns many rows • INVALID CURSOR: An incorrect cursor operation is performed • ZERO DIVIDE: An attempt at zero division
Question:- What are the Various Types of SQL Statements?
Answer:- The five types of SQL statements are as follows: • DDL: Data definition language (DDL) helps in the creation of a database structure or schema. CREATE, DROP, ALTER, RENAME, and TRUNCATE are the five types of DDL commands in SQL. • DML: Data manipulation language (DML) allows you to insert, change, and delete data from a database instance. DML is in charge of making all kinds of changes to a database’s data. The database application and the user can insert data and information using three basic commands—INSERT, UPDATE, and DELETE. • DCL: GRANT and REVOKE are the commands in the data control language (DCL) that can be used to grant rights and permissions. The database system’s parameters are controlled by other permissions. • TCL: Transaction control language (TCL) commands deal with database transactions. Some of the TCL commands are COMMIT, ROLLBACK, and SAVEPOINT. • DQL: Data query language (DQL) is used to retrieve data from the database. It just has one command, which is SELECT.
Question:- What are the Different Methods to Trace the PL/SQL Code?
Answer:- Tracing the code is a crucial technique to measure its performance during the runtime. The different methods of tracing the code include: • DBMS_APPLICATION_INFO • DBMS_TRACE • DBMS_SESSION and DBMS_MONITOR • trcsess and tkprof utilities
Question:- What are the Various Types of Parameters in PL/SQL?
Answer:- There are three types of parameters in PL/SQL. They are as follows: • IN: The IN parameter allows you to send values to the procedure that is being called. The IN parameter can be set to default values. It behaves as a constant and cannot be changed. • OUT: The OUT parameter returns a value to the caller. The OUT parameter is an uninitialized variable that cannot be used in expressions. • IN OUT: The IN OUT parameter sends starting values to a procedure and returns the updated values to the caller. This parameter should be treated as an initialized variable and given a value.
Question:- What are PL/SQL Records?
Answer:- PL/SQL records are a collection of values. To put it another way, PL/SQL records are a collection of many pieces of information, each of which is of a simpler type and can be associated with one another as fields. Three types of records are supported in PL/SQL: • Records based on tables • Records created by programmers • Records that are based on a cursor
Question:- Why do we use Index in a Table?
Answer:- We use an index in a table to allow quick access to rows. For procedures that return a small percentage of a table’s rows, an index allows quicker access to data.
Question:- What is the Difference among Functions, Procedures, and Packages in PL/SQL?
Answer:- • Functions: The main purpose of PL/SQL functions is to compute and return a single value. The functions have a return type in their specifications and must return a specified value in that type. • Procedures: Procedures do not have a return type and should not return any value, but they can have a return statement that simply stops its execution and returns to the caller. Procedures are used to return multiple values; otherwise, they are generally similar to functions. • Packages: Packages are schema objects that group logically related PL/SQL types, items, and subprograms. You can also say that packages are a group of functions, procedures, variables, and record TYPE statements. Packages provide modularity, which aids in application development. Packages are used to hide information from unauthorized users.
Question:- Why are Database Links Used?
Answer:- Database links are used to establish communication across multiple databases or environments such as test, development, and production. Other information can also be accessed using database links, which are read-only.
Question:- What is a Stored Procedure?
Answer:- A stored procedure is a sequence of statements or a named PL/SQL block that performs one or more specific functions. It is similar to a procedure in other programming languages. It is stored in the database and can be repeatedly executed. It is stored as a schema object and can be nested, invoked, and parameterized.
Question:- What is the Overloading of a Procedure?
Answer:- When the name of the same procedure is repeated with the parameters of different data types and parameters in different places, then that is referred to as procedure overloading.
Question:- What is meant by Expressions?
Answer:- Expressions are made up of a series of literals and variables that are separated by operators. Operators are used in PL/SQL to manipulate, compare, and calculate data. Expressions are made up of two parts, operators and operands.
