What are Cursors? Explain Types of cursors in PL/SQL
Correct Answer
Cursors help you manipulate the information retrieved by select statements This can be done by assigning a name to the cursor Example: CURSOR emp_cur IS SELECT emp_number from employee_tbl where employee_name = name_in; Types of Cursors: Implicit cursors- These cursors are not declared by the programmer They are issued when the SQL statement is executed The open, close and fetching is done by itself Example: UPDATE employee SET salary = salary * 21; Here, an implicit cursor is issued to identify the set of rows in the table which would be affected by the update Explicit cursors- These cursors are defined by programmer They are used in queries that return multiple rows Example: CURSOR emp_cur IS SELECT emp_number from employee_tbl where employee_name = name_in;
Correct Answer: - Mask the real name and owner of an object - Provide public access to an object - Provide location transparency for tables, views or program units of a remote database - Simplify the SQL statements for database users
Correct Answer: ANALYZE command is used to perform various functions on index, table, or cluster, as listed below: - It helps in dentifying migrated and chained rows of the table or cluster - It helps in validating the structure of the object - It helps in collecting the statistics about object used by the optimizer They are then stored in the data dictionary - It helps in deleting statistics used by object from the data dictionary
Correct Answer: The principle distinction amongst sessions and cookies is that sessions are put away on the server, and cookies are put away on the client's PCs in the content record position Cookies can not hold various variables,But Session can hold numerous variablesWe can set expiry for a cookie,The session just stays dynamic the length of the program is openUsers don't have admittance to the information you put away in Session,Since it is put away in the server Session is mostly utilized for login/logout reason while cookies utilizing for client movement following
Correct Answer: The PHP default variable $_PHP_SELF is utilized for the PHP script name and when you click "submit" catch then same PHP script will be called
6. What are PL/SQL Subprograms? What are its Advantages ?
Correct Answer: Named PL/SQL blocks of code which can be invoked using parameters are called PL/SQL sub programs Advantages of PL/SQL subprograms are - The application makes a single call to the database to run a block of statements which improves performance against running SQL multiple times This will reduce the number of calls between the database and the application - PL/SQL is secure since the code resides inside the database thus hiding internal database details from the application The application will only make a call to the PL/SQL sub program - PL/SQL and SQL go hand in hand so there would be no need of any translation required between PL/SQL and SQL
7. What is a Trigger? Explain Types of PL/SQL Triggers.
Correct Answer: A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database The trigger is mostly used for maintaining the integrity of the information on the database Syntax: CREATE OR REPLACE TRIGGER [Trigger Name] [Before / After / Instead Of] ON [schema][table] Types of PL/SQL triggers : > Row trigger - The trigger fires for each ROW affected > Statement trigger - The trigger is fired once when the condition is matched > Before and After trigger - The BEFORE trigger run the trigger action before the insert, update or delete statement The AFTER trigger runs the trigger action after the insert, update or delete statement is executes
8. What are transaction isolation levels supported by Oracle?