select * from rpt.han_Rashojdenie_Diag_pg(
CAST($1 AS int8),
CAST($2 AS int8),
CAST($3 AS int8),
CAST($4 AS int8), 
CAST($5 AS int8),
CAST(TO_TIMESTAMP($6,'DD.MM.YYYY') AS TIMESTAMP), 
CAST(TO_TIMESTAMP($7,'DD.MM.YYYY') AS TIMESTAMP)
)
