views:

73

answers:

1

Sup guys, heres my view:

CREATE OR REPLACE VIEW SISTEMA.VWTELA AS
SELECT
TEL_DLTELA AS Tela,
TEL_DLDESCRICAO As Descricao,
TEL_DLTABELA As Tabela,
CASE WHEN to_char(TEL_STATIVO) = to_char(1) THEN 
  to_char('Yes')
  ELSE
    to_char('No')
    END as Ativo,
TEL_IDTELA AS IDTEL
FROM SISTEMA.TEL_TELA;

When i do a SELECT * FROM SISTEMA.VWTELA it works fine from PL/SQL Developer but when i launch the query from my VB.NET application it throws me a super annoying error ORA-01722.

Any ideas? The Application code works perfecty with any query so its not application code error but prolly some "super cool feature" from ODP.NET.

Already tried to_number, to_whatever and same error always happens.

+1  A: 

replace

CASE WHEN to_char(TEL_STATIVO) = to_char(1) THEN 
  to_char('Yes')
  ELSE
    to_char('No')
    END as Ativo,

to

to_char(CASE WHEN to_char(TEL_STATIVO) = to_char(1) THEN 
  'Yes'
  ELSE
    'No'
    END) as Ativo,

ODP.NET now recognizes this view.

Alex
'Yes' and 'No' are already strings, so the TO_CHAR() conversion is unnecessary. It is annoying when clients don't handle the exception under these circumstances, but sometimes they have expectations which are too high for human fallibility.
APC