nerdexam
Oracle

1Z0-882 · Question #13

Consider the CREATE FUNCTION statement: CREATE FUNCTION countrycount () BEGIN DECLARE count INT; SELECT COUNT (*) INTO count FROM country; RETURN count ; END What is the outcome when you try to…

The correct answer is D. An error result as the variable type returned by the function must be defined with a RETURNS. Routine Functions must provide a RETURNS clause noting data-type just after func_name and parameters, before characteristics.

Stored Programs

Question

Consider the CREATE FUNCTION statement:

CREATE FUNCTION countrycount () BEGIN DECLARE count INT; SELECT COUNT (*) INTO count FROM country; RETURN count ; END What is the outcome when you try to create the function?

Options

  • AAn error results as the SELECT must assign the return values to a user variable.
  • BAn error results as the count variable is not initialized with a value.
  • CAn error result as the function must be defined with the CONTAINS SQL clause.
  • DAn error result as the variable type returned by the function must be defined with a RETURNS

How the community answered

(71 responses)
  • A
    4% (3)
  • B
    15% (11)
  • C
    6% (4)
  • D
    75% (53)

Explanation

Routine Functions must provide a RETURNS clause noting data-type just after func_name and parameters, before characteristics.

Topics

#stored functions#RETURNS clause#function definition#CREATE FUNCTION syntax

Community Discussion

No community discussion yet for this question.

Full 1Z0-882 Practice