Advertisement
Guest User

Untitled

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