create or replace package mail_link
as
	function new (
		 mail_id		in mail_link_mail_map.mail_id%TYPE,
		 url			in mail_links.url%TYPE
	) return integer;

	procedure delete (
		 link_id		in mail_links.link_id%TYPE
	);
end mail_link;
/
show errors


create or replace package body mail_link
as
	function new (
		 mail_id		in mail_link_mail_map.mail_id%TYPE,
		 url			in mail_links.url%TYPE
	) return integer
	is
		v_link_id	mail_links.link_id%TYPE;
	begin
		select mail_links_seq.nextval into v_link_id
		from dual;

		insert into mail_links (link_id, url)
		values (v_link_id, new.url);

		insert into mail_link_mail_map (mail_id, link_id)
		values (new.mail_id, v_link_id);

		return v_link_id;
	end new;

	procedure delete (
		 link_id		in mail_links.link_id%TYPE
	) is
	begin
		delete from mail_links where link_id = mail_link.delete.link_id;
	end delete;
end mail_link;
/
show errors
