Oracle has a different syntax from MySQL for creating a function, but generally works the same way, as shown in the following query:
CREATE FUNCTION hittinglevel(g_all IN NUMBER)
RETURN VARCHAR AS
hitlevel VARCHAR(10);
BEGIN
hitlevel := CASE
WHEN g_all BETWEEN 0 and 10 THEN 'barely any'
WHEN g_all BETWEEN 11 and 50 THEN 'some'
WHEN g_all BETWEEN 51 and 100 THEN 'many'
ELSE 'tons'
END;
RETURN hitlevel;
END;
You can call the function and drop the function the same way that you do in MySQL.