Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: using CHAR datatype (Oracle)
using CHAR datatype (Oracle)
Posted: 2005/06/30 03:26
 
Hi,

What do I need to set in order to get data from Oracle and the sentence contains a char field in the where clause. I tried with fdFixedWidth in the field type (using parameters) but the query returns no rows, but yes there rows with that condition.

Using D7 and the last version of AnyDAC.

Thanks

Guillermo Ortega.
RE: using CHAR datatype (Oracle)
Posted: 2005/06/30 16:03
 
Hello !

You should execute query as either:

1)
ADQuery1.SQL.Text := 'SELECT * FROM MyTab WHERE Trim(CharField) = ';
ADQuery1.Params[0].AsString := 'qwe';
ADQuery1.ExecSQL;

2)
ADQuery1.SQL.Text := 'SELECT * FROM MyTab WHERE CharField = ';
ADQuery1.Params[0].AsString := 'qwe '; // padded by spaces to the CharField column length
ADQuery1.ExecSQL;

Regards,
Dmitry
RE: using CHAR datatype (Oracle)
Posted: 2005/06/30 19:21
 
Thanks Dmitry,

I was trying to avoid that because i'm using your components in a object persistence framework (used for the last 4 years), and I try to avoid the use of fuctions, but i'm going to check that again.

Guillermo
RE: using CHAR datatype (Oracle)
Posted: 2005/07/01 17:51
 
Hi !

I have implemented additionally following:

ADQuery1.SQL.Text := 'SELECT * FROM MyTab WHERE CharField = ';
with ADQuery1.Params[0] do begin
Size := 5;
AsFixedChar := 'qwe';
(* or
Size := 5;
DataType := ftFixedChar;
AsString := 'qwe';
*)
end;
ADQuery1.ExecSQL;

Regards,
Dmitry
RE: using CHAR datatype (Oracle)
Posted: 2005/07/01 23:10
 
Thanks Dmitry,

I would consider that for implementing in the framework,

Guillermo Ortega.
RE: using CHAR datatype (Oracle)
Posted: 2005/07/01 23:25
 
Next week should be new AnyDAC release.

Regards,
Dmitry