drop function if exists sp_delete_language( p_language_id integer );
create or replace function sp_delete_language( p_language_id integer ) returns integer as $$
declare
	retval integer;
begin
	retval:=0;
	select count(*) into retval from languages where language_id=p_language_id;
	delete from language_langdefs where language_id=p_language_id;
	delete from languages where language_id=p_language_id;
	return retval;
end;
$$language plpgsql;

comment on function sp_delete_language( p_language_id integer ) is 'delete language';
