User-Defined Functions «Prev  Next»

Returning Functions Syntax in Oracle - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 
1. You wish to create a function named FIND_LOWEST that returns the lowest insurance rate (in dollars and cents) for your customer, given the customer's home state. Which code snippet would be valid for the CREATE...AS portion of your function?
Please select the best answer.
  A. CREATE FIND_LOWEST (CUSTOMER_STATE IN VARCHAR2) RETURN NUMBER AS
  B. CREATE FUNCTION FIND_LOWEST (HOMESTATE IN VARCHAR2) RETURN NUMBER(10,2) AS
  C. CREATE FUNCTION FIND_LOWEST (STATE_NAME IN VARCHAR2) RETURN NUMBER AS
  D. CREATE FUNCTION FIND_LOWEST (STATE_NAME IN VARCHAR2) RETURN RATE_NUMBER AS

2. Look at this SQL code snippet and select all the answers that are true.
Please select all the correct answers.
  A. This function has two parameters.
  B. This function returns a number .
  C. This function uses an implicit cursor.
  D. This function has one variable.

3. Which of the following scenarios is appropriate for a function that returns a Boolean value?
Please select the best answer.
  A. You need a function that can be used in the WHERE clause of an SQL query to determine whether or not a person has a valid driver's license.
  B. You want to create a function that determines whether an insurance claim is within your company's guidelines.
  C. You create a function that finds the telephone rate for phone call based on the date and time of the call, and the customer's long distance plan.
  D. You need a function that gives you the due date of a customer's invoice.