Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Error query

  1. #1
    Join Date
    Feb 2011
    Posts
    240

    Default Error query

    The error of this query is: ORA-00933: SQL command completed incorrectly

    but I can not find the error.
    Can you help me please?

    select

    cartella_eta.anno_elab as anno,
    to_number(to_char(int_data_prest,'MM'),'99') as "mese",
    interv.int_cartella as "cartella",
    substr(trim(cartella.cognome)||' '||trim(cartella.nome),1,40) as "cognome_nome",
    cartella.data_nasc as "data_nasc",
    cartella_eta.eta,
    cartella.sesso,
    cartella.cod_fisc as "codice_fiscale",
    interv.int_cod_comune as "cod_comune",
    comuni.descrizione as "comune",
    int_cod_areadis as "cod_areadis",
    areadis.descrizione as "areadis",
    distretti.cod_zona as "cod_zona",
    zone.descrizione_zona as "zona",
    areadis.cod_distretto as "cod_distretto",
    distretti.des_distr as "distretto",
    interv.int_cod_oper as "cod_operatore",
    substr(trim(operatori.cognome)||' '||trim(operatori.nome),1,40) as "operatore",
    interv.int_tipo_oper as "cod_tipo_oper",
    trim(tab_voci.tab_descrizione) as "tipo_oper",
    interv.int_qual_oper as "cod_qual_oper",
    operqual.desc_qualif as "qual_oper",
    interv.int_codpres as "cod_presidio",
    presidi.despres as "presidio",
    interv.int_ambdom as "ambdom",
    count(*) as "numero",
    nvl(sum(int_tempo),0) as "t_accessi",
    nvl(sum(int_tempogo),0) as "t_tempogo"


    from
    sinsnt_test.interv,
    sinsnt_test.cartella,
    sinsnt_test.cartella_eta,
    sinsnt_test.comuni,
    sinsnt_test.areadis,
    sinsnt_test.zone,
    sinsnt_test.distretti,
    sinsnt_test.presidi,
    sinsnt_test.tab_voci,
    sinsnt_test.operqual,
    sinsnt_test.operatori

    where
    to_char(int_data_prest, 'YYYY') = to_char(anno_elab)
    and int_cartella = cartella.n_cartella
    and int_cod_comune = comuni.codice
    and int_cod_areadis = areadis.codice
    and areadis.cod_distretto = distretti.cod_distr
    and distretti.cod_zona = zone.codice_zona
    and int_cod_oper = operatori.codice
    and int_qual_oper = operqual.cod_qualif
    and int_codpres = presidi.codpres
    and 'TIPOPE'= tab_voci.tab_cod
    and int_tipo_oper=tab_voci.tab_val

    group by

    cartella_eta.anno_elab,
    to_number(to_char(int_data_prest,'MM'),'99'),
    interv.int_cartella,
    substr(trim(cartella.cognome)||' '|| trim(cartella.nome),1,40),
    cartella.data_nasc,
    cartella_eta.eta,
    cartella.sesso,
    cartella.cod_fisc,
    interv.int_cod_comune,
    comuni.descrizione,
    int_cod_areadis,
    areadis.descrizione,
    distretti.cod_zona,
    zone.descrizione_zona,
    areadis.cod_distretto,
    distretti.des_distr,
    interv.int_cod_oper
    substr(trim(operatori.cognome)||' '||trim(operatori.nome),1,40),
    interv.int_tipo_oper,
    trim(tab_voci.tab_descrizione),
    interv.int_qual_oper,
    operqual.desc_qualif,
    interv.int_codpres,
    presidi.despres,
    interv.int_ambdom

  2. #2
    Join Date
    Jun 2011
    Posts
    102

    Default

    Hi,
    you miss some field in the group by, that's the only one problem i can find.
    When you use a function like count, max or min you have to insert in the group by all the fields you are extracting from the select.
    HTH,
    Andrea

  3. #3
    Join Date
    Feb 2011
    Posts
    240

    Default

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.