Tag: databases

Questions Related to databases

  1. cursor_name%Found

  2. cursor_name%NOTFOUND

  3. cursor_name%OPEN

  4. cursor_name%ROWCOUNT


Correct Option: C
  1. SQL%Found

  2. SQL%ISOPEN

  3. SQL%NOTFOUND

  4. SQL%ROWCOUNT


Correct Option: B
    1. select banner from v$version;
    1. select version from v$instance;
    1. select version from v$version;
  1. Both 1 and 2

  2. Both 2 and 3


Correct Option: D
  1. Too_many_rows

  2. No_Data_Found

  3. Divide_Error

  4. Zero_Error


Correct Option: C
  1. Cursor_Already_Open

  2. Cursor_Not_Closed

  3. Invalid_Cursor

  4. None of the Above


Correct Option: B
  1. USER

  2. UID

  3. CURVAL

  4. All are valid


Correct Option: D
  1. >0 for positive value

  2. 0 for positive value

  3. 0 for negative value

  4. 1 for positive value


Correct Option: D
  1. RAISE_ERROR

  2. SQLERRM

  3. RAISE_APPLICATION_ERROR

  4. RAISE_SERVER_ERROR


Correct Option: C
Explanation:

To solve this question, the user needs to have knowledge of error handling in SQL.

Now, let's go through each option and explain why it is right or wrong:

A. RAISE_ERROR: This option is not a valid procedure to create a custom error message in SQL. RAISE_ERROR is not a standard Oracle SQL function.

B. SQLERRM: This option is not a procedure to create a custom error message, but it is a function that returns the error message associated with the most recently raised error exception. It is not used to raise custom exceptions.

C. RAISE_APPLICATION_ERROR: This option is correct. RAISE_APPLICATION_ERROR is a procedure used to create a customized error message in Oracle SQL. It allows an application to raise an error with a user-defined error message and error number.

D. RAISE_SERVER_ERROR: This option is not a valid procedure to create a custom error message in SQL. RAISE_SERVER_ERROR is not a standard Oracle SQL function.

Therefore, the correct answer is: C. RAISE_APPLICATION_ERROR

  1. It causes the cursor to close

  2. It loads the current row values into variables

  3. It causes the cursor to open

  4. It creates the variables to load the values


Correct Option: B
Explanation:

When rows are found using a FETCH statement in SQL, it loads the current row values into variables.

Option B is the correct answer. The FETCH statement is used to retrieve rows from a cursor, and each time it is executed, it fetches the next row from the cursor result set and assigns the values to the specified variables. This allows us to work with the data retrieved from the cursor.

Here is a breakdown of the other options:

A. It causes the cursor to close: This option is incorrect. The FETCH statement does not close the cursor; it only retrieves the rows. The cursor can be closed explicitly using the CLOSE statement.

C. It causes the cursor to open: This option is incorrect. The FETCH statement is used after the cursor has been declared and opened. It does not open the cursor itself.

D. It creates the variables to load the values: This option is incorrect. The variables to hold the row values need to be declared before the FETCH statement is executed. The FETCH statement does not create the variables, but rather assigns the retrieved values to the existing variables.

Therefore, the correct answer is B. It loads the current row values into variables.