-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [Criteria] How to use 'to_char' pgres function?
PostPosted: Tue Sep 25, 2007 2:58 pm 
Newbie

Joined: Tue Sep 25, 2007 2:45 pm
Posts: 1
Hello, i'm trying to create a criteria to execute a SQL query that uses the 'to_char' function from postgres. I also need to make a cast from string to integer in the query.

I just can't find a way to do it using Criteria.

Code:
SELECT documento.id as id_documento,alunopre.id as id_alunoPre FROM alunopre
INNER JOIN nucleo on alunopre.nucleo_id = nucleo.id
INNER JOIN projeto on nucleo.projeto_id = projeto.id
INNER JOIN projetodocumento ON projetodocumento.projeto_id=projeto.id
INNER JOIN documento ON projetodocumento.documento_id = documento.id
except
(
SELECT documento.id as id_documento,alunopre.id as id_alunoPre FROM alunopre
INNER JOIN alunopreprojetodocumento ON alunopreprojetodocumento.alunopre_id = alunopre.id
INNER JOIN projetodocumento ON alunopreprojetodocumento.projetodocumento_id = projetodocumento.id
INNER JOIN documento ON projetodocumento.documento_id = documento.id
where CAST(to_char(NOW(), 'YYYY') AS integer) < (CAST(to_char((alunopreprojetodocumento.dataentrega), 'YYYY') AS integer)+projetodocumento.prazovalidade)
) order by id_documento


Any ideas about how to do it?

Sorry for my english, I think i must train it a little more.

If you have doubts about what i wrote, plz let me know.

Thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.