Default Values
Default Values
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
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
The problem is nopt resolved
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
What is the procedure that use ODAC for receive the default value from the system table of Oracle ?
Thanks
Default Value : Sample Code
This is a small example about Default Value
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
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
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
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 :
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