CREATE OR REPLACE PROCEDURE set_website_name(in_url text) AS $$
DECLARE
	temp_website_id integer;
	temp_website_name text;
	temp_website website%ROWTYPE;
BEGIN
	temp_website_name = get_website_name(in_url);

	SELECT * INTO temp_website FROM website
	WHERE website.name = temp_website_name;

    IF NOT FOUND THEN
        INSERT INTO website (name) VALUES (temp_website_name);
    END IF;

	SELECT website.id INTO temp_website_id FROM website
	WHERE website.name = temp_website_name;

	UPDATE artist_website SET website_id = temp_website_id
	WHERE url = in_url;
END;
$$ LANGUAGE plpgsql;
