Default Values

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dpsistemi
Posts: 8
Joined: Tue 01 Mar 2005 11:22

Default Values

Post by dpsistemi » Tue 01 Mar 2005 11:35

Hi !

I'm using ODAC 5.50.15 in D5

Compliments, the property DefaultValue is very interesting, but ...

Well, I use TOraQuery with two or more Table in join.
There is a column that is present in both table, but the format is different, in first is number(3,0) default value 0, in second is varchar2(1) default 'N'.
The statement SQL use the field in first table.

When Delphi try to insert record, i receive the error

'N' is not a valid floating point value for field 'COLLI'

Another case is that the default value is USERS, or SYSDATE, or NULL.
In this case, i receive the string value, and not the value

Thanks

dpsistemi
Posts: 8
Joined: Tue 01 Mar 2005 11:22

Sorry

Post by dpsistemi » Tue 01 Mar 2005 11:52

I found where is the problem.

In Delphi, in TFloatField the Default Expression there is 'N'

Delete my post, sorry

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Tue 01 Mar 2005 12:13

OK,
Server functions like SYSDATE are not supported by Odac as default values

dpsistemi
Posts: 8
Joined: Tue 01 Mar 2005 11:22

The problem is nopt resolved

Post by dpsistemi » Tue 01 Mar 2005 14:32

Seems that the problem of default values is not resolved.

What is the procedure that use ODAC for receive the default value from the system table of Oracle ?

Thanks

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 02 Mar 2005 09:00

This is internal routine and if you are not Pro version user than you can't access it, but if there is any problem in it we will fix it. Pls. specify your problem circumstances and scripts to create server objects, or send us small demo project with scripts to ODAC support address.

dpsistemi
Posts: 8
Joined: Tue 01 Mar 2005 11:22

Default Value : Sample Code

Post by dpsistemi » Wed 02 Mar 2005 09:23

This is a small example about Default Value

Code: Select all

CREATE TABLE ART (
  ID    NUMBER(*)   NOT NULL,
  AZ    VARCHAR2(3),
  ART   VARCHAR2(20),
  DES   VARCHAR2(70),
...
  COLLI VARCHAR2(1) DEFAULT 'N' ,
...
) 

CREATE TABLE BOL_TESTA (
  ID     NUMBER(*, 0) NOT NULL,
  AZ     VARCHAR2(3) NOT NULL,
  ANNO   VARCHAR2(4),
  TDOC   VARCHAR2(3),
  CL_DOC VARCHAR2(3),
  NDOC   NUMBER(*, 0),
  DTDOC  DATE,
  DTREG  DATE,
...
  COLLI  NUMBER(*) DEFAULT 0,
...
) 

-- Statement of Select

SELECT a1.ROWID, a1.ID, a1.AZ, a1.ANNO, a1.TDOC,
       a1.ID_ART, a2.ART, a2.DES as ART_DES,
       a1.COLLI,
       ...
  FROM BOL_TESTA a1, ART a2
 WHERE a1.ID = :ID
   AND a2.ID = a1.ID_:ART

Well, the field COLLI is present in both table, but the format and default values is different.
When in Delphi I activate the property Default Value, and i try to insert, the ODAC fill the field COLLI (alias a1 (BOL_TESTA) not a2 (ART)) with the value 'N' not 0.

Thanks for your help

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 02 Mar 2005 12:51

We reproduced your problem and fixed it. This fix will be included in the next ODAC build.

By now you can change your SQL to the following :

Code: Select all

 SELECT a1.ROWID, a1.ID, a1.AZ, a1.ANNO, a1.TDOC,
       a1.ID_ART, a2.ART, a2.DES as ART_DES,
       a1.COLLI,
       ...
  FROM ART a2, BOL_TESTA a1
 WHERE a1.ID = :ID
   AND a2.ID = a1.ID_:ART

Post Reply