Précédent   Forum des professionnels en informatique > Bases de données > PostgreSQL
PostgreSQL Forum PostgreSQL. Avant de poster -> F.A.Q PostGreSQL Tutoriels PostGreSQL
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 26/04/2007, 10h49   #1
Membre actif
 
Inscription : janvier 2007
Messages : 57
Détails du profil
Informations personnelles :
Localisation : France, Puy de Dôme (Auvergne)

Informations forums :
Inscription : janvier 2007
Messages : 57
Points : 165
Points : 165
Par défaut Probleme parametre SQL

Bonjour à tous,
J'ai une requête dans laquelle je passe 4 paramètres :

select T1.saninp___rforefide, T1.saninp___rfodomide, T1.saninpspe, TEMPS_CHIRUR, TEMPS_OCCUPA, 100*TEMPS_CHIRUR/TEMPS_OCCUPA as TAUX_ACTE_CHIRUR
from
(select saninp___rforefide, saninp___rfodomide, saninpspe, sanphr___rsaphaide, SUM(extract(epoch from sanphrdtf-sanphrdtd)) as TEMPS_CHIRUR
from sanphr, saninp
where sanphr___rforefide = saninp___rforefide
and sanphr___rfodomide = saninp___rfodomide
and sanphr___rsamvtide = saninp___rsamvtide
and sanphr___saninpide = saninpide
and sanphr___rsaphaide = 'ST'
and saninpsin <> 'Annulé'
and saninpdtd >= ?
and saninpdtd < ?
group by saninp___rforefide, saninp___rfodomide, saninpspe, sanphr___rsaphaide) as T1,--somme des temps d'acte chirurgical / specialité
(select saninp___rforefide, saninp___rfodomide, saninpspe, SUM(extract(epoch from sanrusdtf-sanrusdtd)) as TEMPS_OCCUPA
from sanrus, saninp
where saninpsin <> 'Annulé'
and sanrus___rforefide = saninp___rforefide
and sanrus___rfodomide = saninp___rfodomide
and sanrus___rsamvtide = saninp___rsamvtide
and sanrus___saninpide = saninpide
and sanrus___rfocreide = 'SALLE'
and sanrusdtd >= ?
and sanrusdtd < ?
and sanrusdtf <> '2100-12-31 00:00:00+01'
group by saninp___rforefide, saninp___rfodomide, saninpspe
order by saninp___rforefide, saninp___rfodomide, saninpspe) as T2 --somme des temps d'occupation des salles / specialité
where T1.saninp___rforefide = T2.saninp___rforefide
and T1.saninp___rfodomide = T2.saninp___rfodomide
and T1.saninpspe = T2.saninpspe
order by T1.saninp___rforefide, T1.saninp___rfodomide, T1.saninpspe

En exécutant cette requête j'obtiens l'erreur suivante :
PSQLException: L'indice de la colonne est hors limite : 3, nombre de colonnes : 2.

Pourtant, si je remplace mes ''?'' par une valeur "en dure" tout marche bien.
Quelqu'un pourrait-il m'aider?

Merci d'avance.
Arnaud
arno a. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/04/2007, 11h40   #2
Membre actif
 
Inscription : janvier 2007
Messages : 57
Détails du profil
Informations personnelles :
Localisation : France, Puy de Dôme (Auvergne)

Informations forums :
Inscription : janvier 2007
Messages : 57
Points : 165
Points : 165
Problème résolu, en fait le problème venait des commentaires figurant dans mon code SQL, en les enlevant tout marche. Strange...

Arnaud
arno a. est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 02h01.


 
 
 
 
Partenaires

Hébergement Web