Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Syntax of PL/pgSQL
Function parameters
Handling exceptions
Summary
27. Exercise 2

Instruction

Good stuff! Let's move on the next exercise.

Exercise

Create the display_powers() function that will loop over the integer numbers between 1 and 10.

It should print out the cube of all odd numbers and the square of all even numbers. See the required output below:

NOTICE: The cube of 1 is: 1
NOTICE: The square of 2 is: 4
NOTICE: The cube of 3 is: 27
NOTICE: The square of 4 is: 16
NOTICE: The cube of 5 is: 125
NOTICE: The square of 6 is: 36
NOTICE: The cube of 7 is: 343
NOTICE: The square of 8 is: 64
NOTICE: The cube of 9 is: 729
NOTICE: The square of 10 is: 100