Page 1 of 1

Default Values

Posted: Tue 01 Mar 2005 11:35
by dpsistemi
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

Sorry

Posted: Tue 01 Mar 2005 11:52
by dpsistemi
I found where is the problem.

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

Delete my post, sorry

Posted: Tue 01 Mar 2005 12:13
by Paul
OK,
Server functions like SYSDATE are not supported by Odac as default values

The problem is nopt resolved

Posted: Tue 01 Mar 2005 14:32
by dpsistemi
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

Posted: Wed 02 Mar 2005 09:00
by Alex
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.

Default Value : Sample Code

Posted: Wed 02 Mar 2005 09:23
by dpsistemi
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

Posted: Wed 02 Mar 2005 12:51
by Alex
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