-------------------------------------------------------------------------------
-- procedures_ex_jdbc.sql
-------------------------------------------------------------------------------

create or replace procedure anniversaire(n personne.nom%type) is
begin
    update personne set age = age + 1 where nom = n;
end;
/

exec anniversaire('Riton');
select * from personne;

create or replace function age(n personne.nom%type) 
    return personne.age%type 
is
    a personne.age%type;
begin
    select age into a from personne where nom = n;
    return a;
end;
/

set serveroutput on
exec dbms_output.put_line(age('Riton'));
select * from personne;

create or replace procedure age_out(
    n personne.nom%type, a out personne.age%type) 
is
begin
    select age into a from personne where nom = n;
end;
/

declare
    a personne.age%type;
begin
    age_out('Riton', a);
    dbms_output.put_line(a);
end;
/

select * from personne;

-------------------------------------------------------------------------------




