Requête oracle vers postgres
Bonjour j'ai deux requêtes qui passaient en oracle et qui ne passe plus en postgres :
Requête 1 :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| select to_char(s.date_synchro, 'YYYY') as annee,
to_char(s.date_synchro, 'MM') as mois_chiffre,
to_char(s.date_synchro, 'MONTH') as mois,
to_char(s.date_synchro, 'WW') as semaine,
substr('t.Date_Synchro', 0, 10) as date_synchro,
t.nb_appli_tmp as nb_applis,
s.nb_job_tmp as nb_jobs
from stat_applis t, STAT_JOBS s
where substr(t.Date_Synchro ,0 ,10) SIMILAR TO substr(s.Date_Synchro ,0 ,10)
and s.ID_DOMAINE = t.ID_DOMAINE and s.ID_DOMAINE = 1
and to_char(s.date_synchro, 'DAY') like '%LUNDI%'
order by annee desc,semaine desc |
erreur
Code:
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
l'erreur vient de substr a priori mais je ne vois pas pourquoi quand je regarde dans le manuel postgres, j'ai bien cette option présente avec la même synthaxe.
Requête 2 :
Code:
1 2 3 4 5 6 7
| select e.environnement,a.application,(((LENGTH(a.liens_vers) - LENGTH(REPLACE(a.liens_vers, ',')))/ LENGTH(',')) + 1) AS nb_liens_applis,j.job,(((LENGTH(j.liens_vers) - LENGTH(REPLACE(j.liens_vers, ',')))/ LENGTH(',')) + 1) AS nb_liens_jobs
from t_environnement e,t_application a, t_job j
where e.id_environnement_ora = a.id_environnement_ora
and j.id_application_ora = a.id_application_ora
and j.id_domaine = 1
and j.machine not like '%poub%'
order by e.environnement,a.application,j.job |
message d'erreur :
Code:
1 2 3 4
| ERROR: function replace(character varying, unknown) does not exist
LINE 1: ...nt,a.application,(((LENGTH(a.liens_vers) - LENGTH(REPLACE(a....
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts. |
idem, la fonction replace existe aussi en postgres, je ne vois pas pourquoi cela ne colle pas.