databases Online Quiz - 237
|Description: databases Online Quiz - 237|
|Number of Questions: 20|
|Created by: Aliensbrain Bot|
Which character is used to continue a statement in SQL*Plus?
Which character function can be used to return a specified portion of a character string
To answer this question, you need to understand the character functions used in string manipulation.
Option A) INSTR - This option is incorrect because the INSTR function is used to find the starting position of a specified substring within a string.
Option B) SUBSTRING - This option is incorrect because the SUBSTRING function is used to extract a substring from a string based on a specified starting position and length.
Option C) SUBSTR - This option is correct because the SUBSTR function is used to extract a substring from a string based on a specified starting position and, optionally, a length.
Option D) POS - This option is incorrect because there is no standard character function called POS in most programming languages or database systems.
The correct answer is C) SUBSTR. This option is correct because the SUBSTR function is specifically designed to return a specified portion of a character string.
To use Global temporary tables in a compound statement you require which type of tablespace to be present
Which of the following is not true for Stored Procedures?
To answer this question, let's go through each option to understand why it is correct or incorrect:
Option A) Simplifies code reuse, code standardization, and code maintenance - This option is true for Stored Procedures. Stored Procedures provide a way to encapsulate a set of SQL statements into a single unit, making it easier to reuse the code, maintain a standard structure, and update the code in one place.
Option B) Controlled access to other database objects - This option is true for Stored Procedures. Stored Procedures can control access to other database objects by specifying the necessary permissions and privileges required to execute the procedure. This helps in enforcing security and preventing unauthorized access to the database.
Option C) Improving application performance - This option is true for Stored Procedures. Stored Procedures can improve application performance by reducing network traffic. Instead of sending multiple SQL statements from the application to the database, the application can call a single Stored Procedure that performs the necessary operations on the database server, reducing the overhead of multiple round trips.
Option D) DB2 Stored Procedures can be written only in SQL - This option is not true for Stored Procedures. DB2 Stored Procedures can be written in other programming languages such as COBOL, C, Java, etc., in addition to SQL. This allows developers to leverage the power of different programming languages to implement complex business logic within the Stored Procedures.
The correct answer is D. This option is not true because DB2 Stored Procedures can be written in languages other than SQL.
What is the Output ?
CREATE PROCEDURE wise.Test123 (IN VAR1 INTEGER) P1: BEGIN DECLARE C1 CURSOR WITH RETURN TO CLIENT FOR SELECT DISTINCT NO FROM (VALUES (1),(2),(3),(3),(2)) AS TEST (NO); SET VAR1= VAR1 * VAR1 +VAR1; END P1@ What happens when you call wise.Test123 (10)
A file rahul.db2 has following content : Drop procedure rahul ( ) @ Create procedure rahul ( ) P1: begin Declare c1 cursor with return to client for Select current date from sysibm.sysdummy1; Open c1; End P1 @ What will following command do when fired on db2 command linedb2 –td@ -f rahul.db2
A Simple stored procedure is created with Dynamic Result sets 3 However only 2 cursors with return to client are defined within the source code. What will happen when you call the SP ?
What one is valid special register?
CREATE PROCEDURE testproc( IN i1 INT, INOUT i3 INT) SPECIFIC testproc BEGIN SET i3 = i1; END @ CREATE PROCEDURE testproc( IN i1 INT, INOUT i2 INT, INOUT i3 INT) SPECIFIC testp BEGIN SET i3 = i1 * i2; END @ Given that the statements in the exhibits have executed successfully, which solution contains the complete set of commands that could be used to drop both procedures in the order presented?
CREATE PROCEDURE p1() BEGIN CREATE TABLE T1 (C1 CHAR); INSERT INTO T1 VALUES ('A'); SAVEPOINT SAVEPOINT1 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('B'); SAVEPOINT SAVEPOINT2 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('C'); SAVEPOINT SAVEPOINT3 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('D'); ROLLBACK TO SAVEPOINT SAVEPOINT3; ROLLBACK TO SAVEPOINT SAVEPOINT1; COMMIT WORK; INSERT INTO T1 VALUES ('E'); END@ Call p1() @ How many rows will be present in Table T1
Which IBM tool can you use to debug stored procedure?