IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Développement de jobs Discussion :

requête exécutée dans le referentiel metadonnées mais pas dans un job! pourquoi?


Sujet :

Développement de jobs

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut requête exécutée dans le referentiel metadonnées mais pas dans un job! pourquoi?
    Bonjour à tous,
    S'il vous plait, je suis bloqué, j'ai une requête à exécuter.
    Je peux l’exécuter dans la partie des metadonnées / connexions / requêtes (à gauche dans l'onglet référentiel), j'ai enregistré cette requête et je l'ai utiliser dans mon job avec un tdbinput, et lorsque j'exécute le job il affiche une erreur:java.sql.SQLException: [SQL0104] Elément syntaxique <FIN-INSTRUCTION> n'est pas correct. Éléments possibles : ( + - ? : DAY INF NAN NOT RID ROW,
    si la requête est exécutable dans le référentiel metadonnées, pourquoi elle n'est pas exécutable dan un job simple avec uniquement un tdbinput qui relié avec un fichier excel en sortie, je ne comprends pas, est ce que quelqu'un a une explication je suis vraiment bloqué !!!

  2. #2
    Membre actif Avatar de sofiane_bfm007
    Profil pro
    Consultant Décisionnel
    Inscrit en
    Mai 2008
    Messages
    261
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Consultant Décisionnel

    Informations forums :
    Inscription : Mai 2008
    Messages : 261
    Points : 242
    Points
    242
    Par défaut
    Bonjour,

    Peux-tu poster la requête que tu as utilisé ??

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    Voila la requête, est un peut complexe mais exécutable dans le référentiel metadonnées:
    select
    '1' As Departement, RegionOperationnelle as NomDepartement,
    bai.d01ste as societe, d01rs1 as NomSociete,
    g10mdg as Mandat,
    d30nm1 as NomImmeuble,
    g10ges as Gestionnaire,
    d65lib as NomGestionnaire,
    d03trs as Locataire,
    SoldeAvantTrimestre,
    Encaissement,
    case when Encaissement > 0
    then
    case when SoldeAvantTrimestre >= 0
    then 0
    else
    case when Encaissement + SoldeAvantTrimestre <= 0 then Encaissement else SoldeAvantTrimestre * -1 end
    end
    else 0
    end as EncaissementPourCompenserDebit,
    SoldeADateArrete,
    Quittancement,
    case when Encaissement = 0
    then 0
    else
    case when Quittancement = 0
    then 1
    else
    case when abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / Quittancement ) > 1
    then abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / Quittancement )
    else abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / Quittancement )
    end
    end
    end as TauxEncaissementInstantane,
    case when SoldeAvantTrimestre + Quittancement = 0
    then 1
    else
    case when abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantTrimestre + Quittancement ) ) > 1
    then abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantTrimestre + Quittancement ) )
    else abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantTrimestre + Quittancement ) )
    end
    end as TauxEncaissementCumule,
    substring ( cast ( DebutPeriode as char ( 8 ) ) , 7 , 2 ) || '/' ||
    substring ( cast ( DebutPeriode as char ( 8 ) ) , 5 , 2 ) || '/' ||
    substring ( cast ( DebutPeriode as char ( 8 ) ) , 1 , 4 )
    as DebutPeriode,
    substring ( cast ( DateArrete as char ( 8 ) ) , 7 , 2 ) || '/' || substring ( cast ( DateArrete as char ( 8 ) ) , 5 , 2 ) || '/' || substring ( cast ( DateArrete as char ( 8 ) ) , 1 , 4 ) as DateArrete,
    substring ( cast ( 100 + day ( current date ) as char ( 3 ) ) , 2 , 2 ) || '/' ||
    substring ( cast ( 100 + month ( current date ) as char ( 3 ) ) , 2 , 2 ) || '/' ||
    cast ( year ( current date ) as char ( 4 ) )
    as DateTraitement
    from
    (
    select
    mdg.d01ste, mdg.g10mdg, d30nm1, g10ges, d03trs,
    case when SoldeAvantTrimestre is null then 0 else SoldeAvantTrimestre end as SoldeAvantTrimestre,
    case when Quittancement is null then 0 else Quittancement end as Quittancement,
    case when Encaissement is null then 0 else Encaissement end as Encaissement,
    case when SoldeADateArrete is null then 0 else SoldeADateArrete end as SoldeADateArrete
    from
    (
    select d01ste, g10mdg, d30nm1, g10ges
    from fbase1.g10mdg0
    inner join simco.bx_FGironDatArr DatArr
    on g10agd * 10000 + g10mgd * 100 + g10jgd <= DateArrete
    and ( g10agf = 0 or g10agf * 10000 + g10mgf * 100 + g10jgf >= DateArrete )
    ) mdg
    left outer join
    (
    select d01ste, g10mdg, d03trs,
    sum ( case when c04ade * 10000 + c04mde * 100 + c04jde < DebutPeriode then g30mon else 0 end ) * -1 as SoldeAvantTrimestre,
    sum (
    case when

    (
    ( select count ( * ) from simco.bx_ro where departement = 'VB' ) = 0
    and c04ade * 10000 + c04mde * 100 + c04jde >= DebutPeriode
    )
    or

    (
    ( select count ( * ) from simco.bx_ro where departement = 'VB' ) > 0
    and c04ade * 10000 + c04mde * 100 + c04jde between DebutPeriode and FinPeriode
    )
    then
    case when g30mon > 0 then g30mon else 0 end
    else 0
    end
    ) * -1 as Quittancement,
    sum (
    case when c04ade * 10000 + c04mde * 100 + c04jde >= DebutPeriode
    then
    case when g30mon > 0 then 0 else g30mon end
    else 0
    end
    ) * -1 as Encaissement,
    sum ( g30mon ) * -1 as SoldeADateArrete
    from agirab1.g30hlo0
    inner join simco.bx_FGironDatArr DatArr
    on c04ade * 10000 + c04mde * 100 + c04jde <= DateArrete
    group by d01ste, g10mdg, d03trs

    ) hlo
    on mdg.d01ste = hlo.d01ste
    and mdg.g10mdg = hlo.g10mdg
    ) bai
    inner join simco.bx_FGironDatArr DatArr
    on DateArrete > 0
    left outer join
    (
    select d65rub, d65lib from fbase1.d65ftc0 where upper ( d64cod ) = 'GES'
    ) ftc
    on g10ges = d65rub
    left outer join agirab1.d01ste0 ste
    on bai.d01ste = ste.d01ste
    left outer join (
    select d01ste, regionoperationnelle from agirab1.d01ste0
    inner join simco.bx_ro
    on upper ( activite ) = 'GER'
    and upper ( departement ) = '1'
    and d01ste = societe


    union all

    select d01ste, RegionOperationnelle from agirab1.d01ste0
    inner join simco.bx_ro
    on upper ( activite ) = 'GER'
    and upper ( departement ) = '1'
    where d01ste not in ( select d01ste from agirab1.d01ste0 inner join simco.bx_ro on upper ( departement ) = '1' and d01ste = societe )
    and societe = ''
    ) ro
    on bai.d01ste = ro.d01ste
    order by bai.d01ste, g10mdg, d03trs;


    Merci pour votre réponse

  4. #4
    Membre actif Avatar de sofiane_bfm007
    Profil pro
    Consultant Décisionnel
    Inscrit en
    Mai 2008
    Messages
    261
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Consultant Décisionnel

    Informations forums :
    Inscription : Mai 2008
    Messages : 261
    Points : 242
    Points
    242
    Par défaut
    Essaie avec cela :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    "select
    '1' As Departement, RegionOperationnelle as NomDepartement,
    bai.d01ste as societe, d01rs1 as NomSociete,
    g10mdg as Mandat,
    d30nm1 as NomImmeuble,
    g10ges as Gestionnaire,
    d65lib as NomGestionnaire,
    d03trs as Locataire,
    SoldeAvantTrimestre,
    Encaissement,
    case when Encaissement > 0
    then
    case when SoldeAvantTrimestre >= 0
    then 0
    else
    case when Encaissement + SoldeAvantTrimestre <= 0 then Encaissement else SoldeAvantTrimestre * -1 end
    end
    else 0
    end as EncaissementPourCompenserDebit,
    SoldeADateArrete,
    Quittancement,
    case when Encaissement = 0
    then 0
    else
    case when Quittancement = 0
    then 1
    else
    case when abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / Quittancement ) > 1
    then abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / Quittancement )
    else abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / Quittancement )
    end
    end
    end as TauxEncaissementInstantane,
    case when SoldeAvantTrimestre + Quittancement = 0
    then 1
    else
    case when abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantTrimestre + Quittancement ) ) > 1
    then abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantTrimestre + Quittancement ) )
    else abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantTrimestre + Quittancement ) )
    end
    end as TauxEncaissementCumule,
    substring ( cast ( DebutPeriode as char ( 8 ) ) , 7 , 2 ) || '/' ||
    substring ( cast ( DebutPeriode as char ( 8 ) ) , 5 , 2 ) || '/' ||
    substring ( cast ( DebutPeriode as char ( 8 ) ) , 1 , 4 )
    as DebutPeriode,
    substring ( cast ( DateArrete as char ( 8 ) ) , 7 , 2 ) || '/' || substring ( cast ( DateArrete as char ( 8 ) ) , 5 , 2 ) || '/' || substring ( cast ( DateArrete as char ( 8 ) ) , 1 , 4 ) as DateArrete,
    substring ( cast ( 100 + day ( current date ) as char ( 3 ) ) , 2 , 2 ) || '/' ||
    substring ( cast ( 100 + month ( current date ) as char ( 3 ) ) , 2 , 2 ) || '/' ||
    cast ( year ( current date ) as char ( 4 ) )
    as DateTraitement
    from
    (
    select
    mdg.d01ste, mdg.g10mdg, d30nm1, g10ges, d03trs,
    case when SoldeAvantTrimestre is null then 0 else SoldeAvantTrimestre end as SoldeAvantTrimestre,
    case when Quittancement is null then 0 else Quittancement end as Quittancement,
    case when Encaissement is null then 0 else Encaissement end as Encaissement,
    case when SoldeADateArrete is null then 0 else SoldeADateArrete end as SoldeADateArrete
    from
    (
    select d01ste, g10mdg, d30nm1, g10ges
    from fbase1.g10mdg0
    inner join simco.bx_FGironDatArr DatArr
    on g10agd * 10000 + g10mgd * 100 + g10jgd <= DateArrete
    and ( g10agf = 0 or g10agf * 10000 + g10mgf * 100 + g10jgf >= DateArrete )
    ) mdg
    left outer join
    (
    select d01ste, g10mdg, d03trs,
    sum ( case when c04ade * 10000 + c04mde * 100 + c04jde < DebutPeriode then g30mon else 0 end ) * -1 as SoldeAvantTrimestre,
    sum (
    case when
     
    (
    ( select count ( * ) from simco.bx_ro where departement = 'VB' ) = 0
    and c04ade * 10000 + c04mde * 100 + c04jde >= DebutPeriode
    )
    or
     
    (
    ( select count ( * ) from simco.bx_ro where departement = 'VB' ) > 0
    and c04ade * 10000 + c04mde * 100 + c04jde between DebutPeriode and FinPeriode
    )
    then
    case when g30mon > 0 then g30mon else 0 end
    else 0
    end
    ) * -1 as Quittancement,
    sum (
    case when c04ade * 10000 + c04mde * 100 + c04jde >= DebutPeriode
    then
    case when g30mon > 0 then 0 else g30mon end
    else 0
    end
    ) * -1 as Encaissement,
    sum ( g30mon ) * -1 as SoldeADateArrete
    from agirab1.g30hlo0
    inner join simco.bx_FGironDatArr DatArr
    on c04ade * 10000 + c04mde * 100 + c04jde <= DateArrete
    group by d01ste, g10mdg, d03trs
     
    ) hlo
    on mdg.d01ste = hlo.d01ste
    and mdg.g10mdg = hlo.g10mdg
    ) bai
    inner join simco.bx_FGironDatArr DatArr
    on DateArrete > 0
    left outer join
    (
    select d65rub, d65lib from fbase1.d65ftc0 where upper ( d64cod ) = 'GES'
    ) ftc
    on g10ges = d65rub
    left outer join agirab1.d01ste0 ste
    on bai.d01ste = ste.d01ste
    left outer join (
    select d01ste, regionoperationnelle from agirab1.d01ste0
    inner join simco.bx_ro
    on upper ( activite ) = 'GER'
    and upper ( departement ) = '1'
    and d01ste = societe
     
     
    union all
     
    select d01ste, RegionOperationnelle from agirab1.d01ste0
    inner join simco.bx_ro
    on upper ( activite ) = 'GER'
    and upper ( departement ) = '1'
    where d01ste not in ( select d01ste from agirab1.d01ste0 inner join simco.bx_ro on upper ( departement ) = '1' and d01ste = societe )
    and societe = ''
    ) ro
    on bai.d01ste = ro.d01ste
    order by bai.d01ste, g10mdg, d03trs"

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    ça marche maintenant, je vous remercie, mais qu'est ce que vous avez changé.

  6. #6
    Membre actif Avatar de sofiane_bfm007
    Profil pro
    Consultant Décisionnel
    Inscrit en
    Mai 2008
    Messages
    261
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Consultant Décisionnel

    Informations forums :
    Inscription : Mai 2008
    Messages : 261
    Points : 242
    Points
    242
    Par défaut
    De rien

    J'ai enlevé la virgule et encadré la requête par double quotes " ma requête "

  7. #7
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    Le problème persiste je pense que c'est autre chose, mais je ne sais pas.

  8. #8
    Membre émérite
    Avatar de haskouse
    Homme Profil pro
    Salesforce
    Inscrit en
    Août 2009
    Messages
    923
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Maroc

    Informations professionnelles :
    Activité : Salesforce
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2009
    Messages : 923
    Points : 2 684
    Points
    2 684
    Par défaut
    C'est quoi le problème cette fois-ci ?
    Essai de reposter la requête et pourquoi pas une capture du job.

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    Je trouve pas la solution ça marche maintenant, mais une instruction pareille dans un autre job affiche l'erreur: Elément syntaxique <FIN-INSTRUCTION> n'est pas correct. Eléments possibles : ( + - ? : DAY INF NAN RID ROW RRN
    comment ça fin instruction n'est pas correcte

  10. #10
    Membre émérite
    Avatar de haskouse
    Homme Profil pro
    Salesforce
    Inscrit en
    Août 2009
    Messages
    923
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Maroc

    Informations professionnelles :
    Activité : Salesforce
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2009
    Messages : 923
    Points : 2 684
    Points
    2 684
    Par défaut
    En fait il s'agit d'une erreur dans la syntaxe de ta requête.
    Si tu peux poster la requête ce serait bien.

    ... mais une instruction pareille dans un autre job affiche l'erreur ...
    Essai de comparer les requêtes peut être qu'il y a une erreur qui s'est glissée quelque part.

  11. #11
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    Voila la requête, aidez moi s'ils vous plait.

    "
    select
    RegionOperationnelle, ' "+ ((String)globalMap.get("dep"))+" ' As Departement,
    mvt.d01ste as Societe, d01rs1 as NomSociete,
    c04man as Mandat,
    SoldeAvantDateValidation,
    Encaissement,
    case when Encaissement > 0 then
    case when SoldeAvantDateValidation >= 0 then 0 else
    case when Encaissement + SoldeAvantDateValidation <= 0 then Encaissement else
    SoldeAvantDateValidation * -1 end end
    else 0 end as EncaissementPourCompenserDebit,
    SoldeADateTraitement,
    AppelDeFonds,

    case when Encaissement = 0
    then 0
    else
    case when AppelDeFonds = 0
    then 1
    else
    case when abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / AppelDeFonds ) > 1
    then abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / AppelDeFonds )
    else abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / AppelDeFonds )
    end
    end
    end as TauxEncaissementInstantane,
    case when SoldeAvantDateValidation + AppelDeFonds = 0
    then 1
    else
    case when abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantDateValidation +
    AppelDeFonds ) ) > 1
    then abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantDateValidation +
    AppelDeFonds ) )
    end
    end as TauxEncaissementCumule,
    substring ( DateComptabilisation , 7 , 2 ) || '/' || substring ( DateComptabilisation , 5 ,
    2 ) || '/' || substring ( DateComptabilisation , 1 , 4 ) as DateComptabilisation,
    substring ( cast ( current date as char ( 10 ) ) , 9 , 2 ) || '/' ||
    substring ( cast ( current date as char ( 10 ) ) , 6 , 2 ) || '/' ||
    substring ( cast ( current date as char ( 10 ) ) , 1 , 4 ) as DateTraitement
    from (
    select mvt.d01ste, c04man, hsv.DateValidation, hsv.DateComptabilisation,
    sum ( case when mvt.DateComptabilisation < hsv.DateValidation then c04mon else 0 end ) * -1 as
    SoldeAvantDateValidation,
    sum ( case when mvt.DateComptabilisation >= hsv.DateValidation then Encaissement else 0 end ) as
    Encaissement,
    sum ( case when mvt.DateComptabilisation <= year ( current date ) * 10000 + month ( current date )
    * 100 + day ( current date ) then c04mon else 0 end ) * -1
    as SoldeADateTraitement,
    sum ( case when mvt.DateComptabilisation = hsv.DateComptabilisation then AppelDeFonds else 0 end )
    as AppelDeFonds
    from (
    select d01ste, c04man, c01cpt, c04scp, c04blc,
    c04ade * 10000 + C04mde * 100 + c04jde as DateComptabilisation,
    sum ( case when c04mon < 0 then c04mon else 0 end ) * -1 as Encaissement,
    sum ( case when c04mon > 0 then c04mon else 0 end ) * -1 as AppelDeFonds,
    sum ( c04mon ) as c04mon from agircp"+ ((String)globalMap.get("dep"))+".c04mvt0 mvt
    where c01cpt = 450100
    group by d01ste, c04man, c01cpt, c04scp, c04blc, c04ade * 10000 + C04mde * 100 + c04jde ) mvt
    inner join (
    select d01ste, s10man, S90cpt,
    min ( s91adv * 10000 + s91mdv * 100 + s91jdv ) as DateValidation,
    s90acp * 10000 + s90mcp * 100 + s90jcp as DateComptabilisation,
    sum ( s91mre ) as s91mre
    from agircp"+ ((String)globalMap.get("dep"))+".s91hsv0 hsv
    where s90cpt = 450100 and s90acp * 10000 + s90mcp * 100 + s90jcp = 20110701
    group by d01ste, s10man, s90cpt, s90jcp, s90mcp, s90acp ) hsv
    on mvt.d01ste = hsv.d01ste and mvt.c04man = hsv.s10man and mvt.c01cpt = hsv.s90cpt
    and mvt.DateComptabilisation <= ( case when year ( current date ) * 10000 + month ( current date ) * 100 + day ( current date ) < 20110701
    then 99999999
    else year ( current date ) * 10000 + month ( current date ) * 100 + day ( current date ) end )
    group by mvt.d01ste, c04man, hsv.DateComptabilisation, hsv.DateValidation ) mvt
    left outer join (
    select d01ste, regionoperationnelle from agircp"+ ((String)globalMap.get("dep"))+".d01ste0
    inner join simco.bx_ro
    on upper ( activite ) = 'COP'
    and upper ( departement ) = ' "+ ((String)globalMap.get("dep"))+" '
    and d01ste = societe
    union all
    select d01ste, regionoperationnelle from agircp"+ ((String)globalMap.get("dep"))+".d01ste0
    inner join simco.bx_ro
    on upper ( activite ) = 'COP'
    and upper ( departement ) = ' "+ ((String)globalMap.get("dep"))+" '
    where d01ste not in ( select d01ste from agircp"+ ((String)globalMap.get("dep"))+".d01ste0 inner
    join simco.bx_ro on upper ( departement ) = ' "+ ((String)globalMap.get("dep"))+" ' and d01ste = societe ) and societe = '' ) ro
    on mvt.d01ste = ro.d01ste
    left outer join ( agircp"+ ((String)globalMap.get("dep"))+".d01ste0 ste on mvt.d01ste = ste.d01ste )
    order by RegionOperationnelle, departement , mvt.d01ste

    "

  12. #12
    Membre émérite
    Avatar de haskouse
    Homme Profil pro
    Salesforce
    Inscrit en
    Août 2009
    Messages
    923
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Maroc

    Informations professionnelles :
    Activité : Salesforce
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2009
    Messages : 923
    Points : 2 684
    Points
    2 684
    Par défaut
    Salut,

    Bon c'est un peu difficile de t'aider sur cette requête sans avoir la base pour faire un test. Sinon on ne perd pas éspoir quand même

    J'ai remarqué que tu récupères une variable depuis le globalMap pour la mettre dans ta requête :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ((String)globalMap.get("dep"))
    La première chose à faire c'est de t'assurer que la variable contient belle et bien une valeur, et surtout la bonne valeur.

    Deuxièmement, j'ai supposé que ta variable contient la valeur "toto" et j'ai remplacé dans ta requête, ça me donne ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    select RegionOperationnelle,
           ' toto ' As Departement,
           mvt.d01ste as Societe,
           d01rs1 as NomSociete,
           c04man as Mandat,
           SoldeAvantDateValidation,
           Encaissement,
           case
             when Encaissement > 0 then
              case
             when SoldeAvantDateValidation >= 0 then
              0
             else
              case
             when Encaissement + SoldeAvantDateValidation <= 0 then
              Encaissement
             else
              SoldeAvantDateValidation * -1
           end end else 0 end as EncaissementPourCompenserDebit,
           SoldeADateTraitement,
           AppelDeFonds,
     
           case
             when Encaissement = 0 then
              0
             else
              case
             when AppelDeFonds = 0 then
              1
             else
              case
             when abs((1230.456789 + Encaissement - 1230.456789) / AppelDeFonds) > 1 then
              abs((1230.456789 + Encaissement - 1230.456789) / AppelDeFonds)
             else
              abs((1230.456789 + Encaissement - 1230.456789) / AppelDeFonds)
           end end end as TauxEncaissementInstantane,
           case
             when SoldeAvantDateValidation + AppelDeFonds = 0 then
              1
             else
              case
             when abs((1230.456789 + Encaissement - 1230.456789) /
                      (SoldeAvantDateValidation + AppelDeFonds)) > 1 then
              abs((1230.456789 + Encaissement - 1230.456789) /
                  (SoldeAvantDateValidation + AppelDeFonds))
           end end as TauxEncaissementCumule,
           substring(DateComptabilisation, 7, 2) || '/' ||
           substring(DateComptabilisation, 5, 2) || '/' ||
           substring(DateComptabilisation, 1, 4) as DateComptabilisation,
           substring(cast(current date as char(10)), 9, 2) || '/' ||
           substring(cast(current date as char(10)), 6, 2) || '/' ||
           substring(cast(current date as char(10)), 1, 4) as DateTraitement
      from (select mvt.d01ste,
                   c04man,
                   hsv.DateValidation,
                   hsv.DateComptabilisation,
                   sum(case
                         when mvt.DateComptabilisation < hsv.DateValidation then
                          c04mon
                         else
                          0
                       end) * -1 as SoldeAvantDateValidation,
                   sum(case
                         when mvt.DateComptabilisation >= hsv.DateValidation then
                          Encaissement
                         else
                          0
                       end) as Encaissement,
                   sum(case
                         when mvt.DateComptabilisation <=
                              year(current date) * 10000 + month(current date) * 100 +
                              day(current date) then
                          c04mon
                         else
                          0
                       end) * -1 as SoldeADateTraitement,
                   sum(case
                         when mvt.DateComptabilisation = hsv.DateComptabilisation then
                          AppelDeFonds
                         else
                          0
                       end) as AppelDeFonds
              from (select d01ste,
                           c04man,
                           c01cpt,
                           c04scp,
                           c04blc,
                           c04ade * 10000 + C04mde * 100 + c04jde as DateComptabilisation,
                           sum(case
                                 when c04mon < 0 then
                                  c04mon
                                 else
                                  0
                               end) * -1 as Encaissement,
                           sum(case
                                 when c04mon > 0 then
                                  c04mon
                                 else
                                  0
                               end) * -1 as AppelDeFonds,
                           sum(c04mon) as c04mon
                      from agircptoto.c04mvt0 mvt
                     where c01cpt = 450100
                     group by d01ste,
                              c04man,
                              c01cpt,
                              c04scp,
                              c04blc,
                              c04ade * 10000 + C04mde * 100 + c04jde) mvt
             inner join (select d01ste,
                               s10man,
                               S90cpt,
                               min(s91adv * 10000 + s91mdv * 100 + s91jdv) as DateValidation,
                               s90acp * 10000 + s90mcp * 100 + s90jcp as DateComptabilisation,
                               sum(s91mre) as s91mre
                          from agircptoto.s91hsv0 hsv
                         where s90cpt = 450100
                           and s90acp * 10000 + s90mcp * 100 + s90jcp = 20110701
                         group by d01ste, s10man, s90cpt, s90jcp, s90mcp, s90acp) hsv on mvt.d01ste =
                                                                                         hsv.d01ste
                                                                                     and mvt.c04man =
                                                                                         hsv.s10man
                                                                                     and mvt.c01cpt =
                                                                                         hsv.s90cpt
                                                                                     and mvt.DateComptabilisation <=
                                                                                         (case when
                                                                                          year(current date) *
                                                                                          10000 +
                                                                                          month(current date) * 100 +
                                                                                          day(current date) <
                                                                                          20110701 then
                                                                                          99999999 else
                                                                                          year(current date) *
                                                                                          10000 +
                                                                                          month(current date) * 100 +
                                                                                          day(current date) end)
             group by mvt.d01ste,
                      c04man,
                      hsv.DateComptabilisation,
                      hsv.DateValidation) mvt
      left outer join (select d01ste, regionoperationnelle
                         from agircptoto.d01ste0
                        inner join simco.bx_ro on upper(activite) = 'COP'
                                              and upper(departement) = ' toto '
                                              and d01ste = societe
                       union all
                       select d01ste, regionoperationnelle
                         from agircptoto.d01ste0
                        inner join simco.bx_ro on upper(activite) = 'COP'
                                              and upper(departement) = ' toto '
                        where d01ste not in
                              (select d01ste
                                 from agircptoto.d01ste0
                                inner join simco.bx_ro on upper(departement) =
                                                          ' toto '
                                                      and d01ste = societe)
                          and societe = '') ro on mvt.d01ste = ro.d01ste
      left outer join(agircptoto.d01ste0 ste on mvt.d01ste = ste.d01ste)
     order by RegionOperationnelle, departement, mvt.d01ste
    J'ai utilisé un analyseur synatxique apparemment la syntaxe de ta requête est bonne à 100%, mais je te conseille de faire la même chose que moi, càd de remplacer ta varibale par une vraie valeur et de la tester sur ta base.

    Essai ceci puis fais nous un retour !!

    Bonne chance.

  13. #13
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    ça donne ça
    Exception in component tAS400Input_3
    java.sql.SQLException: [SQL0199] Le mot clé ON est mal placé. Eléments possibles : FULL LEFT CROSS INNER RIGHT EXCEPTION.
    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:621)
    at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1518)
    at com.ibm.as400.access.AS400JDBCStatement.executeQuery(AS400JDBCStatement.java:1949)
    at alim_dwh_postgres.gerappel_loyer_0_1.gerappel_loyer.tAS400Input_2Process(gerappel_loyer.java:1097)
    at alim_dwh_postgres.gerappel_loyer_0_1.gerappel_loyer.runJobInTOS(gerappel_loyer.java:3043)
    at alim_dwh_postgres.gerappel_loyer_0_1.gerappel_loyer.main(gerappel_loyer.java:2903)

  14. #14
    Membre émérite
    Avatar de haskouse
    Homme Profil pro
    Salesforce
    Inscrit en
    Août 2009
    Messages
    923
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Maroc

    Informations professionnelles :
    Activité : Salesforce
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2009
    Messages : 923
    Points : 2 684
    Points
    2 684
    Par défaut
    Il faut être un peu plus clair.
    Dis moi d'abord qu'est ce que tu as fait comme manipulation pour avoir eu cette exception ??

    Autre chose, test ta requête directement sur l'AS400 pour voir ce que ça donne ?

  15. #15
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    c'est une requête d'un reporting exécutée sur une BDD AS400 qui fonctionne très bien, mais avec talend il affiche une erreur de fin d'instruction, c'est vrai c'est un peu compliqué mais c'est correcte, je vous remercie pour votre patience.

  16. #16
    Membre émérite
    Avatar de haskouse
    Homme Profil pro
    Salesforce
    Inscrit en
    Août 2009
    Messages
    923
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Maroc

    Informations professionnelles :
    Activité : Salesforce
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2009
    Messages : 923
    Points : 2 684
    Points
    2 684
    Par défaut
    Il y'a surement une erreur de syntaxe qui s'est glissée quelque part, essai avec ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    "
    select 
    RegionOperationnelle, ' "+ ((String)globalMap.get("dep"))+" ' As Departement,
    mvt.d01ste as Societe, d01rs1 as NomSociete,
    c04man as Mandat,
    SoldeAvantDateValidation,
    Encaissement,
    case when Encaissement > 0 then
    case when SoldeAvantDateValidation >= 0 then 0 else
    case when Encaissement + SoldeAvantDateValidation <= 0 then Encaissement else 
    SoldeAvantDateValidation * -1 end end
    else 0 end as EncaissementPourCompenserDebit,
    SoldeADateTraitement,
    AppelDeFonds,
     
    case when Encaissement = 0
    then 0
    else
      case when AppelDeFonds = 0
      then 1
      else
        case when abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / AppelDeFonds ) > 1
        then abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / AppelDeFonds )     
        else abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / AppelDeFonds )
        end
      end
    end as TauxEncaissementInstantane,
    case when SoldeAvantDateValidation + AppelDeFonds = 0
    then 1
    else
      case when abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantDateValidation + 
    AppelDeFonds ) ) > 1
      then abs ( ( 1230.456789 + Encaissement - 1230.456789 ) / ( SoldeAvantDateValidation + 
    AppelDeFonds ) )     
        end
    end as TauxEncaissementCumule,
    substring ( DateComptabilisation , 7 , 2 ) || '/' || substring ( DateComptabilisation , 5 ,
     2 ) || '/' || substring ( DateComptabilisation , 1 , 4 ) as DateComptabilisation,
    substring ( cast ( current date as char ( 10 ) ) , 9 , 2 ) || '/' ||
    substring ( cast ( current date as char ( 10 ) ) , 6 , 2 ) || '/' ||
    substring ( cast ( current date as char ( 10 ) ) , 1 , 4 ) as DateTraitement
    from (
    select mvt.d01ste, c04man, hsv.DateValidation, hsv.DateComptabilisation,
    sum ( case when mvt.DateComptabilisation < hsv.DateValidation then c04mon else 0 end ) * -1 as 
    SoldeAvantDateValidation,
    sum ( case when mvt.DateComptabilisation >= hsv.DateValidation then Encaissement else 0 end ) as 
    Encaissement,
    sum ( case when mvt.DateComptabilisation <= year ( current date ) * 10000 + month ( current date ) 
    * 100 + day ( current date ) then c04mon else 0 end ) * -1
    as SoldeADateTraitement,
    sum ( case when mvt.DateComptabilisation = hsv.DateComptabilisation then AppelDeFonds else 0 end ) 
    as AppelDeFonds
    from (
    select d01ste, c04man, c01cpt, c04scp, c04blc,
     c04ade * 10000 + C04mde * 100 + c04jde as DateComptabilisation,
    sum ( case when c04mon < 0 then c04mon else 0 end ) * -1 as Encaissement, 
    sum ( case when c04mon > 0 then c04mon else 0 end ) * -1 as AppelDeFonds,
    sum ( c04mon ) as c04mon from agircp"+ ((String)globalMap.get("dep"))+".c04mvt0 mvt
    where c01cpt = 450100
    group by d01ste, c04man, c01cpt, c04scp, c04blc, c04ade * 10000 + C04mde * 100 + c04jde ) mvt
    inner join (
    select d01ste, s10man, S90cpt,
    min ( s91adv * 10000 + s91mdv * 100 + s91jdv ) as DateValidation,
    s90acp * 10000 + s90mcp * 100 + s90jcp as DateComptabilisation,
    sum ( s91mre ) as s91mre
    from agircp"+ ((String)globalMap.get("dep"))+".s91hsv0 hsv
    where s90cpt = 450100 and s90acp * 10000 + s90mcp * 100 + s90jcp = 20110701
    group by d01ste, s10man, s90cpt, s90jcp, s90mcp, s90acp ) hsv
    on mvt.d01ste = hsv.d01ste and mvt.c04man = hsv.s10man and mvt.c01cpt = hsv.s90cpt
    and mvt.DateComptabilisation <= (   case when year ( current date ) *  10000 + month ( current date ) * 100 + day ( current date ) <  20110701
      then 99999999 
      else year ( current date ) * 10000 + month ( current date ) * 100 + day ( current date )   end )
    group by mvt.d01ste, c04man, hsv.DateComptabilisation, hsv.DateValidation ) mvt
    left outer join (
    select d01ste, regionoperationnelle from agircp"+ ((String)globalMap.get("dep"))+".d01ste0
    inner join simco.bx_ro
    on upper ( activite ) = 'COP'
    and upper ( departement ) = ' "+ ((String)globalMap.get("dep"))+" '
    and d01ste = societe
    union all
    select d01ste, regionoperationnelle from agircp"+ ((String)globalMap.get("dep"))+".d01ste0
    inner join simco.bx_ro
    on upper ( activite ) = 'COP'
    and upper ( departement ) = ' "+ ((String)globalMap.get("dep"))+" '
    where d01ste not in ( select d01ste from agircp"+ ((String)globalMap.get("dep"))+".d01ste0 inner 
    join simco.bx_ro on upper ( departement ) = ' "+ ((String)globalMap.get("dep"))+" ' and d01ste = societe ) and societe = '' ) ro
    on mvt.d01ste = ro.d01ste
    left outer join  agircp"+ ((String)globalMap.get("dep"))+".d01ste0 ste  on mvt.d01ste = ste.d01ste
    order by RegionOperationnelle,  departement , mvt.d01ste
     
    "

  17. #17
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    ça a marché, vous avez quoi modifié ?

  18. #18
    Membre émérite
    Avatar de haskouse
    Homme Profil pro
    Salesforce
    Inscrit en
    Août 2009
    Messages
    923
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Maroc

    Informations professionnelles :
    Activité : Salesforce
    Secteur : Conseil

    Informations forums :
    Inscription : Août 2009
    Messages : 923
    Points : 2 684
    Points
    2 684
    Par défaut
    J'ai modifié la ligne suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    LEFT OUTER JOIN(agircptoto.d01ste0 ste ON mvt.d01ste = ste.d01ste)
    En la remplaçant par celle là :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    LEFT OUTER JOIN agircptoto.d01ste0 ste ON mvt.d01ste = ste.d01ste
    Si tu as remarqué la diffèrence, j'ai juste enlevé les deux parenthéses ouvrante puis fermante après le clause LEFT OUTER JOIN.

    N'oublie pas le tag .

    Bonne continuation.

  19. #19
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2011
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2011
    Messages : 106
    Points : 54
    Points
    54
    Par défaut
    Merci c'est résolu

  20. #20
    Futur Membre du Club
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2012
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Novembre 2012
    Messages : 4
    Points : 6
    Points
    6
    Par défaut ERROR: [SQL0104]
    Bonjour,
    svp si quelq'un peux m'aider j'ai la meme erreur quand j'execute le code java pour la connexion à DB2

    ERROR: [SQL0104] Elément syntaxique ; n'est pas correct. Eléments possibles : <FIN-INSTRUCTION>.



    voici mon code java :
    *********************************

    public class GetConnections {

    public static void main(java.lang.String[] args) throws ClassNotFoundException
    {

    Statement stm = null ;
    ResultSet res = null;

    try {

    Class.forName("com.ibm.as400.access.AS400JDBCDriver");




    Connection conn2 = DriverManager.getConnection("jdbc:as400://10.3.6.171:21/bib_tpe" , "", "" );

    System.out.println("Connexion réussie!");


    if (conn2 instanceof com.ibm.as400.access.AS400JDBCConnection)
    System.out.println("conn2 is running under the IBM Toolbox for Java JDBC driver.");
    else
    System.out.println("There is something wrong with conn2.");



    stm=conn2.createStatement();



    res=stm.executeQuery("select * from bib_tpe.test ;");



    while (res.next()){



    System.out.println("ORIGIN :"+res.getString(1));


    }





    conn2.close();
    } catch (SQLException e) {
    System.out.println("ERROR: " + e.getMessage());
    }
    }

    **************************************

    si quelq'un peut m'aider j'en serai trés reconnaissante, merci

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Réponses: 4
    Dernier message: 03/08/2012, 12h05
  2. Réponses: 6
    Dernier message: 24/03/2010, 17h20
  3. [MySQL] Apostrophe dans variable php OK mais pas dans <INPUT>
    Par Zarvox dans le forum PHP & Base de données
    Réponses: 6
    Dernier message: 15/09/2009, 11h55
  4. Champ présent dans une table Firebird mais pas dans TIBDataSet
    Par Mirmillon dans le forum Bases de données
    Réponses: 2
    Dernier message: 11/12/2007, 00h41
  5. Réponses: 11
    Dernier message: 09/04/2006, 14h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo