Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. case when(--for example 8=8
  2. /*8=*/ (select count(*) from voto where new.data=voto.data and
  3. voto_palese='favorevole') =(
  4. /*=8*/ ((
  5. (select count(*) from voto where new.data=voto.data and
  6. voto_palese='favorevole')
  7. UNION(select count(*) from voto where new.data=voto.data and
  8. voto_palese='contrario') UNION
  9. (select count(*) from voto where new.data=voto.data and
  10. voto_palese='astenuto'))/2)+1) and
  11. (select count(*) from voto where new.data=voto.data
  12. and(voto.ddl=new.ddl or voto.mozione=new.mozione))
  13. )
  14. then new.esito='approvato'
  15. else new.esito='non approvato'
  16. end, --esito,
  17.  
  18.  
  19. ERRORE: l'argomento di AND deve essere di tipo booleano, non bigint
  20. LINE 34: (select count(*) from voto where new.data=voto.dat...
  21. ^
  22. QUERY: insert into public.votazione(
  23. mozione,
  24. ddl,
  25. codice,
  26. favorevoli,
  27. votanti,
  28. contrari,
  29. astenuti,
  30. esito,
  31. tipo_assemblea,
  32. seduta_numero,
  33. data,
  34. assenti,
  35. missione)
  36. values((select codice from mozione where codice=new.mozione and
  37. mozione.data=new.data),--mozione,
  38. (select titolo from ddl where titolo=new.ddl), --ddl,
  39. (select codice from ddl where new.ddl=ddl.titolo), --codice,
  40. (select count(*) from voto where new.data=voto.data and
  41. voto_palese='favorevole'), --favorevoli,
  42. ((select count(*) from voto where new.data=voto.data and
  43. voto_palese='favorevole')
  44. UNION(select count(*) from voto where new.data=voto.data and
  45. voto_palese='contrario') UNION
  46. (select count(*) from voto where new.data=voto.data and
  47. voto_palese='astenuto')), --votanti,
  48. (select voto_palese from voto where data=new.data and
  49. voto_palese='contrario'), --contrari,
  50. (select voto_palese from voto where data=new.data and
  51. voto_palese='astenuto'), -- astenuti,
  52. case when(--for example 8=8
  53. /*8=*/ (select count(*) from voto where new.data=voto.data and
  54. voto_palese='favorevole') =(
  55. /*=8*/ ((
  56. (select count(*) from voto where new.data=voto.data and
  57. voto_palese='favorevole')
  58. UNION(select count(*) from voto where new.data=voto.data and
  59. voto_palese='contrario') UNION
  60. (select count(*) from voto where new.data=voto.data and
  61. voto_palese='astenuto'))/2)+1) and
  62. (select count(*) from voto where new.data=voto.data
  63. and(voto.ddl=new.ddl or voto.mozione=new.mozione))
  64. )
  65. then new.esito='approvato'
  66. else new.esito='non approvato'
  67. end, --esito,
  68. (select tipo_assemblea from ordine_del_giorno_ass_cam_e_sen where
  69. data=voto.data), --tipo_assemblea,
  70. (select seduta_numero from ordine_del_giorno_ass_cam_e_sen where
  71. data=voto.data), --seduta_numero,
  72. (SELECT data from ordine_del_giorno_ass_cam_e_sen where
  73. new.tipo_assemblea=ordine_del_giorno_ass_cam_e_sen.tipo_assemblea and
  74. ordine_del_giorno_ass_cam_e_sen.data=voto.data), --data,
  75. (select count(*) from timbratura_giornaliera where presenze='Assente' and
  76. new.data=timbratura_giornaliera.data), --assenti,
  77. (select count(*) from timbratura_giornaliera where presenze='In missione'
  78. and new.data=timbratura_giornaliera.data) -- missione
  79. )
  80. CONTEXT: funzione PL/pgSQL inserimento_votazione() riga 4 a istruzione SQL
  81.  
  82. ********** Error **********
  83.  
  84. ERRORE: l'argomento di AND deve essere di tipo booleano, non bigint
  85. SQL state: 42804
  86. Context: funzione PL/pgSQL inserimento_votazione() riga 4 a istruzione SQL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement