I use a search where the case statement, to display the value of the column case, it shows the value in dbgrig. The Zeos shows the value as memo.
follows the SQL command below.
select a.cd_fil,a.cd_titulo,a.no_doc,a.no_origem,
case
when a.fg_tipo_pgto = 'DIN' then 'Dinheiro'
when a.fg_tipo_pgto = 'CAR' then 'Cartão'
when a.fg_tipo_pgto = 'CHE' then 'Cheque'
when a.fg_tipo_pgto = 'DUP' then 'Duplicata'
when a.fg_tipo_pgto = 'PRO' then 'Promiss.'
when a.fg_tipo_pgto = 'BOL' then 'Boleto'
when a.fg_tipo_pgto = 'DEP' then 'Depósito'
when a.fg_tipo_pgto = 'DDA' then 'DDA'
ELSE 'NDA'
end as .fg_tipo_pgto
,a.no_parcela,a.dt_conta,
a.dt_vcto,a.fg_paga,a.vlr_mov,a.cd_fornec,
b.de_fantasia,a.dt_pgto,a.vlr_pgto
from contapag a,forneced b
where a.cd_fornec = b.cd_fornec
order by a.dt_vcto,a.cd_titulo
--
Edson
Zeos does not recognize the command case of PostgreSQL.
Moderators: gto, EgonHugeist, olehs
Zeos does not recognize the command case of PostgreSQL.
You do not have the required permissions to view the files attached to this post.
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
Hello elidorio2,
the problem is the Postgresql server presumes the result of case command is text. Text type fields are used as memo fields in Zeos. Try casting the result of case command to character varying (20) and you'll get what you want.
example
SELECT ..., CAST( case when .... then .... end as varchar(20)) as fg_tipo_pgto
Good luck!
the problem is the Postgresql server presumes the result of case command is text. Text type fields are used as memo fields in Zeos. Try casting the result of case command to character varying (20) and you'll get what you want.
example
SELECT ..., CAST( case when .... then .... end as varchar(20)) as fg_tipo_pgto
Good luck!
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
Not strange at all
This is how Data Aware component TDbGrid works. It does not show the value for the memo fields.
Someone should correct me if I'm mistaken but it is the libpq that tells the Zeos lib that the column is memo. You could try selecting value from the column that is varchar(N) where N > 255 (300 for example). You'll notice you get memo too. And if you use pgAdmin try Select 'aaa'; You'll see the result is of type text (not char(3) as you might have expected). And text can be as long as 10^9 of Char.
So it is just the way it is. You can cast your long strings or strings of unknown length to something smaller than 255 in length, o you can change the way memofields are displayed. I prefer casting...
Good luck!
This is how Data Aware component TDbGrid works. It does not show the value for the memo fields.
Someone should correct me if I'm mistaken but it is the libpq that tells the Zeos lib that the column is memo. You could try selecting value from the column that is varchar(N) where N > 255 (300 for example). You'll notice you get memo too. And if you use pgAdmin try Select 'aaa'; You'll see the result is of type text (not char(3) as you might have expected). And text can be as long as 10^9 of Char.
So it is just the way it is. You can cast your long strings or strings of unknown length to something smaller than 255 in length, o you can change the way memofields are displayed. I prefer casting...
Good luck!