Advertisement
Guest User

Untitled

a guest
Oct 12th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 1.26 KB | None | 0 0
  1. CREATE OR REPLACE PACKAGE temp_pckg AS
  2.     CURSOR users_counters IS (
  3.         SELECT
  4.             COUNT(users.id) AS Number_of_Users,
  5.             country.country_name AS Country
  6.         FROM
  7.             users,
  8.             users_city,
  9.             city,
  10.             country
  11.         WHERE
  12.             users.id = users_city.users_id AND
  13.             users_city.city_id = city.id AND
  14.             city.country_id = country.id      
  15.         GROUP BY country.country_name
  16.     );
  17.     FUNCTION convert_to_celsius(temperature NUMBER) RETURN NUMBER;
  18.     FUNCTION convert_to_fahrenheit(temperature NUMBER) RETURN NUMBER;
  19. END temp_pckg;
  20.  
  21.  
  22. CREATE OR REPLACE PACKAGE BODY temp_pckg AS  
  23.    
  24.     FUNCTION convert_to_celsius
  25.         ( temperature IN NUMBER )
  26.         RETURN NUMBER
  27.     IS
  28.         converted_temperature NUMBER;
  29.  
  30.     BEGIN
  31.    
  32.         converted_temperature := (temperature - 32) / 1.8;
  33.  
  34.     RETURN converted_temperature;
  35.     END convert_to_celsius;
  36.  
  37.     FUNCTION convert_to_fahrenheit
  38.         ( temperature IN NUMBER )
  39.         RETURN NUMBER
  40.     IS
  41.         converted_temperature NUMBER;
  42.  
  43.     BEGIN
  44.    
  45.         converted_temperature := temperature * 1.8 + 32;
  46.  
  47.     RETURN converted_temperature;
  48.     END convert_to_fahrenheit;
  49. END temp_pckg;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement