Forum APEX - Développement Oracle Application Express

Le site des développeurs francophones APEX - Oracle Application Express

Vous n'êtes pas identifié(e).

Annonce

Bienvenue sur le forum Oracle APEX

S'il s'agit de votre première visite, nous vous invitons à consulter la FAQ en cliquant sur le lien ci-dessous. Vous pouvez poster ici toutes vos questions sur l'installation, le développement (composants clients et serveurs), l'administration des instances Oracle APEX. Par ailleurs, ce forum diffuse les annonces et actualités relatives à Oracle APEX.

Oracle APEX 4.1

Oracle APEX 4.1 est disponible depuis le 24 août 2011.

Oracle APEX 4.0

Oracle APEX 4.0 est disponible depuis le 23 juin 2010. Il existe 2 distributions, une distribution en langue anglaise uniquement et une distribution multilingue.

#1 2011-09-16 10:06:09

apocalypse
Membre
Inscription : 2011-09-02
Messages : 16

ORA-01704....

Bonjour,

Dans l'application que j'essaie de faire j'ai un item qui affiche la clause WHERE de la requête que je construis selon les choix de l'utilisateur.
Cependant j'ai une erreur dernièrement avec l'ajout de nouveaux choix:

    ORA-01461: une valeur 'LONG' ne peut être liée que dans une colonne de type 'LONG'

Je ne vois absolument pas ce qu'il faut faire pour que l'item accepte...

J'ai essayé en modifiant le type de l'item (text, textarea etc...) mais rien n'y fait.

Le bout de code qui produit l'erreur (sachant qu'avant ce bout de code il est fait exactement la même chose pour 3 autres items):

vide := false;
  l_selected_score_prenom := APEX_UTIL.STRING_TO_TABLE(:P_SCORE_PRENOM);
  
  FOR i IN 1..l_selected_score_prenom.count
  LOOP
    if(l_selected_score_prenom(i) = 'vide') then
       vide := true;
    else    
       if score_prenom is null then
          score_prenom := 'scoreprenom in('||chr(39)||l_selected_score_prenom(i)||chr(39);
       else
          score_prenom := score_prenom || ',' || chr(39)|| l_selected_score_prenom(i)||chr(39);
       end if;
    end if;
  END LOOP;

  if(not requete_and) then
     add_where := ' where ';
  else
     add_where := ' and ';
  end if;

  if(vide) then
    if(score_prenom is not null) then  
       score_prenom := add_where||'(scoreprenom is null or '||score_prenom||'))';
    else
       score_prenom := add_where||'scoreprenom is null';
    end if;
  else
    if(score_prenom is not null) then
       score_prenom := add_where||score_prenom||')';
    end if;
  end if;

Merci pour votre aide.

Edit: Voici le code source de l'item au complet car je me suis aperçu qu'en fait cela ne vient pas seulement de la partie score_prenom.
Si je retire la partie statut le code fonctionne, et si je remet à la fin la partie sur le statut j'ai de nouveau l'erreur....


DECLARE
    add_where varchar2(10);
    vide boolean := false;
    requete_and boolean := false;

    l_selected_recence APEX_APPLICATION_GLOBAL.VC_ARR2;
    recence varchar2(100);

    l_selected_sexe APEX_APPLICATION_GLOBAL.VC_ARR2;
    sexe varchar2(100);

    l_selected_statut APEX_APPLICATION_GLOBAL.VC_ARR2;
    statut varchar2(100);

    l_selected_score_prenom APEX_APPLICATION_GLOBAL.VC_ARR2;
    score_prenom varchar2(100);
BEGIN

  l_selected_recence := APEX_UTIL.STRING_TO_TABLE(:P_RECENCE);
  
  FOR i IN 1..l_selected_recence.count
  LOOP
    if(l_selected_recence(i) = 'vide') then
       vide := true;
    else    
       if recence is null then
          recence := 'recence in('||chr(39)||l_selected_recence(i)||chr(39);
       else
          recence := recence || ',' || chr(39)|| l_selected_recence(i)||chr(39);
       end if;
    end if;
  END LOOP;


  if(vide) then
    if(recence is not null) then
       recence := 'where (recence is null or '||recence||'))';
       requete_and := true;
    else
       recence := 'where recence is null';
       requete_and := true;
    end if;
  else
    if(recence is not null) then
       recence := 'where '||recence||')';
       requete_and := true;
    end if;
  end if;

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

  vide := false;
  l_selected_sexe := APEX_UTIL.STRING_TO_TABLE(:P_SEXE);
  
  FOR i IN 1..l_selected_sexe.count
  LOOP
    if(l_selected_sexe(i) = 'vide') then
       vide := true;
    else    
       if sexe is null then
          sexe := 'codesexe in('||chr(39)||l_selected_sexe(i)||chr(39);
       else
          sexe := sexe || ',' || chr(39)|| l_selected_sexe(i)||chr(39);
       end if;
    end if;
  END LOOP;

  if(not requete_and) then
     add_where := ' where ';
     requete_and := true;
  else
     add_where := ' and ';
  end if;

  if(vide) then
    if(sexe is not null) then  
       sexe := add_where||'(codesexe is null or '||sexe||'))';
    else
       sexe := add_where||'codesexe is null';
    end if;
  else
    if(sexe is not null) then
       sexe := add_where||sexe||')';
    end if;
  end if;


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

  vide := false;
  l_selected_statut := APEX_UTIL.STRING_TO_TABLE(:P_STATUT);
  
  FOR i IN 1..l_selected_statut.count
  LOOP
    if(l_selected_statut(i) = 'vide') then
       vide := true;
    else    
       if statut is null then
          statut := 'codesexe in('||chr(39)||l_selected_statut(i)||chr(39);
       else
          statut := statut || ',' || chr(39)|| l_selected_statut(i)||chr(39);
       end if;
    end if;
  END LOOP;

  if(not requete_and) then
     add_where := ' where ';
  else
     add_where := ' and ';
  end if;

  if(vide) then
    if(statut is not null) then  
       statut := add_where||'(statucli is null or '||statut||'))';
    else
       statut := add_where||'statucli is null';
    end if;
  else
    if(statut is not null) then
       statut := add_where||statut||')';
    end if;
  end if;


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

  vide := false;
  l_selected_score_prenom := APEX_UTIL.STRING_TO_TABLE(:P_SCORE_PRENOM);
  
  FOR i IN 1..l_selected_score_prenom.count
  LOOP
    if(l_selected_score_prenom(i) = 'vide') then
       vide := true;
    else    
       if score_prenom is null then
          score_prenom := 'scoreprenom in('||chr(39)||l_selected_score_prenom(i)||chr(39);
       else
          score_prenom := score_prenom || ',' || chr(39)|| l_selected_score_prenom(i)||chr(39);
       end if;
    end if;
  END LOOP;

  if(not requete_and) then
     add_where := ' where ';
  else
     add_where := ' and ';
  end if;

  if(vide) then
    if(score_prenom is not null) then  
       score_prenom := add_where||'(scoreprenom is null or '||score_prenom||'))';
    else
       score_prenom := add_where||'scoreprenom is null';
    end if;
  else
    if(score_prenom is not null) then
       score_prenom := add_where||score_prenom||')';
    end if;
  end if;




  return recence||chr(10)||sexe||chr(10)||statut||chr(10)score_prenom;


END;

Dernière modification par apocalypse (2011-09-16 10:32:30)

Hors ligne

Pied de page des forums