Jump to content

Recommended Posts

Posted

Olá pessoal!

Estou com um problema na execução de uma query. Existe uma comparação que não está a ser feita. Existe uma string a entrar como parâmetro: LastPossibleDate .

Esta é a última condição da minha query:

Código:

"...<query>...
AND ep.publication_date > '" + LastPossibleDate + "'";

Ambas as datas estão no mesmo formato: DD-MON-YYYY

A variável chega com o valor 05-MAY-2009 e simplesmente esta condição não é respeitada.

Quando faço os testes no cliente Oracle SQL Developer tudo corre bem.

Já tentei usar as funções to_char() e to_date() e nada funcionou.

Estou a usar uma ligação OleDbConnection para aceder ao SGBD Oracle (Database 10g Enterprise Edition Release 10.2.0.3.0) e a programar em C# (FW 3.5).

Obrigado por toda a ajuda que possam dar!

Posted

Em que é que baseias para dizer que a condição não é respeitada?

Aparece datas com o formato "04-MAY-2009"?

"Give a man a fish and he will eat for a day; Teach a man to fish and he will eat for a lifetime. The moral? READ THE MANUAL !"

Sign on a computer system consultant's desk

Posted

Sim mas algum com dia 1?

Porque se no sql estiver a comparar com strings, "20-MAY-2008" é efectivamente maior que "05-MAY-2009".

A letra 2 é maior que a letra 0.

"Give a man a fish and he will eat for a day; Teach a man to fish and he will eat for a lifetime. The moral? READ THE MANUAL !"

Sign on a computer system consultant's desk

Posted

Problema resolvido. 😞 Foi muito bem visto.

Realmente, fazendo DESC à minha tabela, vejo que a coluna é do tipo Date.

Fiz então o seguinte:

ep.publication_date > to_date('" + LastPossibleDate + "', 'dd-mon-yyyy')";

...e resultou!

Mas que falta de atenção! heheheh

Thanks dude!!!

Posted

No probs. 😞

Marca o tópico como resolvido.

"Give a man a fish and he will eat for a day; Teach a man to fish and he will eat for a lifetime. The moral? READ THE MANUAL !"

Sign on a computer system consultant's desk

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.