I am a C#, MS SQL developer who is new to Oracle PL/SQL.
My question is probably simple to you experts.
I created a function that searches for a substring within a string and returns the substring if found or 'none' if not found.
I am calling the function in a select statement using the dual table.
CREATE OR REPLACE FUNCTION area_code (phone_number IN VARCHAR2)
RETURN VARCHAR2 AS
IF phone_number LIKE '___-___-____' THEN
--we have a phone number with an area code.
--there is no area code
select area_code('716') from dual ;
select area_code('716-123-456') from dual ;
Also returns 'none'
What am I missing?