MySQL Stored Functions
- What is abc in the following statement?
DECLARE abc HANDLER FOR def ghi;
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The ‘DECLARE HANDLER’ statement is used to declare a handler. When a condition whose value matches def, MySQL will execute ghi and either continue or exit the current code block.
- For the same input parameters, if the stored function returns the same result, it is called _____________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
For the same input parameters, if the stored function returns the same result, it is called a deterministic function. Otherwise, the stored function is called not deterministic.
- Which variable is set to zero when automatic privilege granting is not needed?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The automatic_sp_privileges system variable is set to zero when the automatic privilege granting is not needed and revocation should not be allowed to occur. It is a crucial system variable.
- Suppose a stored function named PI() is written in the database ‘sampdb’. How would it be called?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
When a stored function is defined with the same name as a built in function, the function name should be qualified with the database name when it is invoked. The function ‘PI()’ is built in.
- How many values can be returned from a given stored function?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
In MySQL, the stored function cannot return multiple values. Instead, multiple stored functions can be written and invoked from within a single statement however. They are different from stored procedures.