MySQL Stored Functions


  1. What is abc in the following statement?
    DECLARE abc HANDLER FOR def ghi;











  1. 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.


  1. For the same input parameters, if the stored function returns the same result, it is called _____________.











  1. 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.



  1. Which variable is set to zero when automatic privilege granting is not needed?











  1. 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.


  1. Suppose a stored function named PI() is written in the database ‘sampdb’. How would it be called?











  1. 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.



  1. How many values can be returned from a given stored function?











  1. 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.