DROP TABLE personne;

CREATE TABLE personne (nom VARCHAR2(20) NOT NULL, prenom VARCHAR2(20));

INSERT INTO personne VALUES ('Bourdieu','Pierre');
INSERT INTO personne VALUES ('Darboux','Jean');
INSERT INTO personne VALUES ('de Fermat','Pierre');
INSERT INTO personne VALUES ('Jaures','Jean');
INSERT INTO personne VALUES ('Mendes-France','Pierre');

CREATE OR REPLACE PACKAGE Types AS
  TYPE cursor_type IS REF CURSOR;
END Types;
/

CREATE OR REPLACE FUNCTION
  curseur_pour_prenom(p IN personne.prenom%TYPE) RETURN Types.cursor_type IS
  c Types.cursor_type;
BEGIN
  OPEN c FOR SELECT nom FROM personne WHERE prenom=p ORDER BY nom;
  RETURN c;
END;
/
