This is starting to drive me crazy and I cannot find the reason why this ain't working!
The tables have triggers on them so cityID and postcodeID get populated automatically. The purpose of this function is to find a city with the same name and return its ID else add it to the table and return the new ID.
CREATE OR REPLACE FUNCTION resolveCity(cityNameIn IN VARCHAR2)
RETURN NUMBER AS
cityIDOut NUMBER;
BEGIN
SELECT cityID
INTO cityIDOut
FROM tblCities
WHERE cityName = cityNameIn;
IF cityIDOut IS NULL THEN
-- Add this city to the list
INSERT INTO tblCities (cityName)
VALUES (cityNameIn)
RETURNING cityID INTO cityIDOut;
END IF;
RETURN(cityIDOut);
END;
/