Problème requête oracle sous VBA

Résolu
zubbys Messages postés 12 Date d'inscription jeudi 26 octobre 2006 Statut Membre Dernière intervention 17 août 2007 - 27 nov. 2006 à 11:15
cs_MPi Messages postés 3877 Date d'inscription mardi 19 mars 2002 Statut Membre Dernière intervention 17 août 2018 - 27 nov. 2006 à 23:16
Bonjour j'ai un problème avec une requête vers une base de donnée oracle,

Le message d'erreur est : incompatibilité de type.

mon code est le suivant :

.CommandText = Array( _
"SELECT PK_SS_Tache,USR_LB_NOMPRENOM,TPT_LB_LIB, SST_DT_DEB_PREV, SST_DT_DEB_REEL, SST_DT_FIN, SST_DUREE_PREV, SST_DUREE_REEL  ," _
& Chr(13) & "" & Chr(10) & "FK_TACHE FROM PLM_SS_TACHE , PLM_USER , PLM_TYP_TACH" _
& Chr(13) & "" & Chr(10) & " WHERE PK_USER (+) = PLM_SS_TACHE.FK_USER" _
& Chr(13) & "" & Chr(10) & " AND PK_TYP_TACH = PLM_SS_TACHE.FK_TYP_TACH" _
& Chr(13) & "" & Chr(10) & " ORDER by PK_ss_tache")

.Name = "Lancer la requête à partir de Procedures"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With

End Sub

a priori le problème est situé sur cette ligne :

& Chr(13) & "" & Chr(10) & " AND PK_TYP_TACH = PLM_SS_TACHE.FK_TYP_TACH" _

lorsque je l'enlève je n'ai plus d'erreur d'imcompatibilité de type mais une "erreur générale ODBC".
Si quelqu'un pouvait m'aider ce serait sympas car je n'arrive pas a aller plus loin ....

bye

5 réponses

zubbys Messages postés 12 Date d'inscription jeudi 26 octobre 2006 Statut Membre Dernière intervention 17 août 2007
27 nov. 2006 à 16:26
Je n'arrive pas non plus a convertir mes autres requêtes tel que :



select USR_LB_NOMPRENOM,MOD_LB_LIB, TPT_LB_LIB, TCH_OBJ, EQP_LB_LIB, SST_DT_DEB_PREV, SST_DT_DEB_REEL, SST_DT_FIN, SST_DUREE_PREV, SST_DUREE_REEL  ,
FK_TACHE, Qzn_annee, QZN_LB_Lib, TCH_NU_DOSS,TCH_RESOL, TPB_LB_LIB, PK_SS_Tache
from PLM_SS_TACHE , PLM_USER , PLM_TYP_TACH, PLM_TACHE ,PLM_QUINZAINE , PLM_TYP_PROB, PLM_EQUIPE, PLM_MODELE
where PK_USER (+) = PLM_SS_TACHE.FK_USER
and PK_TYP_TACH = PLM_SS_TACHE.FK_TYP_TACH
and PK_TACHE = FK_TACHE
and PK_Quinzaine=FK_Quinzaine
and PK_TYP_PROB = FK_TYP_PROB
and PLM_TACHE.FK_Equipe = PK_Equipe
and PK_MODELE = FK_MODELE
and SST_DT_FIN is not null
and SST_DT_DEB_REEL > to_date('2006/10/15','yyyy/mm/dd')
and SST_DT_DEB_REEL < to_date('2006/11/01','yyyy/mm/dd')
order by SST_DT_DEB_REEL, PK_ss_tache

un peu d'aide serais la bienvenue je suis dessus depuis ce matin :(
ps : j'ai une requête qui fonctionne là voici

.CommandText = Array( _
"SELECT LIP_PROCEDURE.PK_PROCEDURE, LIP_PROCEDURE.PRC_D_HIST" & Chr(13) & "" & Chr(10) & _
"FROM LIPU.LIP_PROCEDURE LIP_PROCEDURE" & Chr(13) & "" & Chr(10) & _
"ORDER BY LIP_PROCEDURE.PK_PROCEDURE" _
)

donc si vous avez une iddée ^^
3
stefsoft Messages postés 119 Date d'inscription lundi 15 avril 2002 Statut Membre Dernière intervention 28 novembre 2008
27 nov. 2006 à 11:34
Pourquoi faire des "retour chariot"  dans ta requete?

"SELECT PK_SS_Tache,USR_LB_NOMPRENOM,TPT_LB_LIB, SST_DT_DEB_PREV, SST_DT_DEB_REEL, SST_DT_FIN, SST_DUREE_PREV, SST_DUREE_REEL  ," & _
"FK_TACHE FROM PLM_SS_TACHE , PLM_USER , PLM_TYP_TACH"  & _
" WHERE PK_USER (+) = PLM_SS_TACHE.FK_USER" _
" AND PK_TYP_TACH = PLM_SS_TACHE.FK_TYP_TACH"  & _
" ORDER by PK_ss_tache")
0
zubbys Messages postés 12 Date d'inscription jeudi 26 octobre 2006 Statut Membre Dernière intervention 17 août 2007
27 nov. 2006 à 11:44
La requête est sur plusieurs lignes je pense donc devoir faire des retour chariot.
la requête originale est  :

select PK_SS_Tache,USR_LB_NOMPRENOM,TPT_LB_LIB, SST_DT_DEB_PREV, SST_DT_DEB_REEL, SST_DT_FIN, SST_DUREE_PREV, SST_DUREE_REEL  ,
FK_TACHE  from PLM_SS_TACHE , PLM_USER , PLM_TYP_TACH
where PK_USER (+) = PLM_SS_TACHE.FK_USER
and PK_TYP_TACH = PLM_SS_TACHE.FK_TYP_TACH
order by PK_ss_tache

je veut faire en sorte de pouvoir faire cette requête sur vba mais j'ai ce problème ....
Sinon sans les retour chariot ça ne fonctionne pas non plus.
0
zubbys Messages postés 12 Date d'inscription jeudi 26 octobre 2006 Statut Membre Dernière intervention 17 août 2007
27 nov. 2006 à 13:58
S'il vous plait j'ai vraiment besoin d'y arriver et je ne sait pas comment faire .. :s
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_MPi Messages postés 3877 Date d'inscription mardi 19 mars 2002 Statut Membre Dernière intervention 17 août 2018 23
27 nov. 2006 à 23:16
Je n'y connais rien en Oracle, mais à quoi servent les Chr(13) et Chr(10) à l'intérieur d'une requête ???

et que contiennent ces champs comme données ?
PK_TYP_TACH  et PLM_SS_TACHE.FK_TYP_TACH

MPi
0
Rejoignez-nous