[Lazarus] problem with ORACLE

Hector S. Ponce hectorsponce at gmail.com
Fri Mar 11 01:18:47 CET 2011


Sorry, it seems the link http://dl.dropbox.com/u/1172938/files.zip to 
get all related png files was ommited. The link is still alive and the 
file can be downloaded.

The problem is as follows:

I have a very simple form with a dbgrid, sqlquery, oracleconnection, 
datasource, ... the result of execution is shown in dbgrid ...

The SQL.text property of sqlquery is set as:

select c.D10027_TIPO_CONV as tipo,
     C.D10027_NRO_SOL as nro,
     c.D10027_AMORT as deuda,
     c.D10027_CREDITO as credito,
     c.D10027_AMORT - c.D10027_CREDITO as dif
from
     sigem.d10027 c
where
     c.D10027_TIPO_CONV = 80 and
     c.D10027_AMORT - c.D10027_CREDITO < 0.1 and
     c.D10027_AMORT - c.D10027_CREDITO > 0

when I run the same sql inside TOAD, I get this result:

tipo    nro    deuda    credito    dif
80      6043   1.83     0.90       0.93

but from my program the result is

tipo    nro    deuda    credito    dif
80      6043   1.83     0.90             (dif field is not retrieved)


if I change SQL in sqlquery to:
...
     to_char(c.D10027_AMORT - c.D10027_CREDITO, '0.00') as dif
...
to get "dif" as string, the result is correct, as from TOAD.


If the connection at design time is open when I try to change sql 
statement in sqlquery, one window error message appears:

"The metadata is not available for this type of database."

The table can by created with this script:

CREATE TABLE SIGEM.D10027
(
   D10027_TIPO_CONV        NUMBER(2)             NOT NULL,
   D10027_NRO_SOL          NUMBER(7)             NOT NULL,
   D10027_NRO_CUOTA        NUMBER(3)             NOT NULL,
   D10027_CONCEPTO         NUMBER(3)             NOT NULL,
   D10027_CCAJA            NUMBER(4),
   D10027_F_VTO_AAAA       NUMBER(4),
   D10027_F_VTO_MM         NUMBER(2),
   D10027_F_VTO_DD         NUMBER(2),
   D10027_AMORT            NUMBER(9,2),
   D10027_INTERES          NUMBER(9,2),
   D10027_PAGADO           NUMBER(9,2),
   D10027_F_PAGO_AAAA      NUMBER(4),
   D10027_F_PAGO_MM        NUMBER(2),
   D10027_F_PAGO_DD        NUMBER(2),
   D10027_ESTADO           NUMBER(1),
   D10027_LEGAL            NUMBER(1),
   D10027_REFERENCIA       NUMBER(7),
   D10027_LUGAR_PAGO       NUMBER(1),
   D10027_RECIBO           NUMBER(12),
   D10027_PAGO_ADELANTADO  NUMBER(5,2),
   D10027_CREDITO          NUMBER(9,2),
   D10027_EXIM             NUMBER(5,2),
   D10027_IVA_TIPO         CHAR(2 BYTE),
   D10027_IVA_CUIT         CHAR(11 BYTE),
   D10027_FACTURADO        NUMBER(1),
   D10027_FILLER           CHAR(7 BYTE)
)

Oracle version: 10g

CodeTyphon 1.4
Lazarus 0.9.31   Source from SVN 24-01-2011 Rev 29208 (Plus)
FreePascal 2.5.1 Source from SVN 24-02-2011 Rev 16995

http://dl.dropbox.com/u/1172938/files.zip




El 10/03/2011 01:53 p.m., Joost van der Sluis escribió:
> On Thu, 2011-03-10 at 11:30 -0300, Héctor S. Ponce wrote:
>> I encountered a problem working with ORACLE: data resulting from a SQL
>> not match thrown by the same SQL executed with TOAD. The problem
>> occurs with a calculated field. There is also an error message
>> referring to the metadata.
>
> What is the sql-statment, how is the calculated field defined, what do
> you expect (ie: what gives TOAD) and what do you get. And finally: (the
> one thing you should always mention, on every question involving an
> error-message) what is the exact error message.
>
> Joost.
>





More information about the Lazarus mailing list