Executer un package en pl/sql

firewire21 Messages postés 28 Statut Membre -  
 modio -
Bonjour salut tout le monde je voulais seulement savoir c'est quoi la commande pour puvoir executer
un package dans oracle en pl/sql
merci d'avance,
Configuration: Windows XP
Firefox 2.0.0.12

3 réponses

  1. iuoala
     
    j'ai essyer d'ecrire un package comme suit mais il me donne un erreur de compilation lors de la creation
    create or replace package joueurs is

    procedure ajout(v_idj in joueur.idjoueur%type,
    v_nomj in joueur.nomjoueur%type,
    v_ideq in joueur.ideq%type);
    procedure suppression(v_idj in joueur.idjoueur%type);
    procedure Affichage1(v_idj in joueur.idjoueur%type);
    end joueurs;
    /

    create or replace package body joueurs is

    procedure ajout
    (v_idj in joueur.idjoueur%type,
    v_nomj in joueur.nomjoueur%type,
    v_ideq in joueur.ideq%type) is

    err_idj exception;
    pragma exception_init(err_idj,-00001);
    err_eq exception;
    pragma exception_init(err_eq,-02291);
    begin
    insert into joueur values(v_idj,v_nomj,'o',v_ideq,null,null,null);
    exception
    when err_idj then
    insert into trace values('idjoueur existe deja');
    when err_eq then
    insert into trace values('equipe inconnue');
    end ajout;

    procedure suppression(v_idj in joueur.idjoueur%type)is
    cursor cu is select idjoueur from joueur;
    err_eq exception;
    err_pmj exception;
    pragma exception_init(err_pmj,-02292);
    v_i int:=0;
    v_idjoueur joueur.idjoueur%type;
    begin
    open cu;
    loop
    fetch cu into v_idjoueur;
    exit when cu%notfound;
    if(v_idjoueur=v_idj) then
    v_i:=1;
    end if;
    end loop;
    close cu;
    if(v_i=0) then
    raise err_eq;
    end if;
    delete from joueur where idjoueur=v_idj;
    exception
    when err_pmj then
    insert into trace values('joueur existe dans matchjoueur');
    when err_eq then
    insert into trace values('joueur inconnu');
    end suppression;

    procedure Affichage1(v_idj in joueur.idjoueur%type) is
    cursor cu1 is select idjoueur from joueur;
    v_i int:=0;
    v_idj1 joueur.idjoueur%type;
    v_nomj joueur.nomjoueur%type;
    v_idjoueur joueur.idjoueur%type;
    err_eq exception;
    begin
    open cu;
    loop
    fetch cu into v_idjoueur;
    exit when cu%notfound;
    if(v_idjoueur=v_idj) then
    v_i:=1;
    end if;
    end loop;
    close cu;
    if(v_i=0) then
    raise err_eq;
    end if;
    select idjoueur,nomjoueur into v_idj1,v_nomj from joueur
    where idjoueur=v_idj;
    insert into trace values(v_idj1||' '||v_nomj);
    exception
    when err_eq then
    insert into trace values('joueur inconnu');
    end affichage1;
    end joueurs;
    /
    merci d'avance
    1
  2. sdkaber Messages postés 12 Statut Membre 1
     
    je cherche quelqu'un m'aider,
    j'ai un package comportant une seule procedure,mais j'ai problème de compilation
    et voila mon code :
    create or replace procedure ajout_Pdf(codef Varchar2(100),fichier Varchar2(100)) is
    l_lob BLOB;
    l_fichier BFILE;
    BEGIN
    SELECT fichier_pdf INTO l_lob FROM journal WHERE ns=8881 FOR UPDATE;
    l_fichier := bfilename('DIRLOB','3.pdf');
    dbms_lob.fileopen( l_fichier, dbms_lob.file_readonly );
    dbms_lob.loadfromfile( l_lob, l_fichier, dbms_lob.getlength(l_fichier));
    dbms_lob.filecloseall();
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END;
    0