Question:- What Data Types are Present in PL/SQL?
Answer:- There are various kinds of data types present in PL/SQL. They are: 1. Scalar: The scalar data type is a one-dimensional data type with no internal components. CHAR, DATE, LONG, VARCHAR2, NUMBER, and BOOLEAN are some examples of the scalar data type. 2. Composite: The composite data type is made up of different data types that are easy to update and have internal components that can be utilized and modified together. For instance, RECORD, TABLE, VARRAY, and so on. 3. Reference: The reference data type stores pointers, which are values that relate to other programs or data elements. REF CURSOR is an example of the reference data type. 4. Large Object: The large object data type stores locators, which define the location of large items stored out of line such as video clips, graphic images, and so on. BLOB, BFILE, CLOB, and NCLOB are examples of the large object data type.
Question:- What are the Basic Parts of a Trigger?
Answer:- There are three basic parts of a trigger. They are: • A triggering statement or event • A restriction • An action
Question:- How is the Process of PL/SQL Compiled?
Answer:- Syntax checking, binding, and P-code generation are all part of the compilation process. Syntax checking looks for compilation issues in PL/SQL code. After all mistakes have been fixed, the data holding variables are given a storage address. This process is referred to as binding. The PL/SQL engine’s P-code is a set of instructions. For named blocks, P-code is saved in the database and used the next time it is run.
Question:- What is a Join?
Answer:- A join is a query that combines rows from two or more tables, views, or materialized views. A join is performed by the Oracle Database whenever there are multiple tables in the FROM clause of the query. Most of these queries contain at least one join condition, either in the FROM or WHERE clause.
Question:- What is a View?
Answer:- A view is created by joining one or more tables. It is a virtual table that is based on the result set of an SQL statement; it contains rows and columns, just like a real table. A view can be created with the CREATE VIEW statement.
Question:- What Does a PL/SQL Package Consist Of?
Answer:- A PL/SQL package consists of: • PL/SQL table and record type statements • Procedures and functions • Cursors • Variables, such as tables, scalars, records, etc., and constants • Exception names and pragmas for relating an error number with an exception • Cursors
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
