Page 1 of 1

How can I find the true database field type

Posted: Sat 01 Sep 2012 06:56
by sinys
How can I find the true database field type?

db type | visible type in grid
long -> memo
long raw -> blob
nclob -> hugeclob
raw -> varbytes

Re: How can I find the true database field type

Posted: Mon 03 Sep 2012 10:14
by bork
Hello

What does it mean "true database field type"? Can you explain this term more detailed?

To get field classes in the run-time you can use the following code:

Code: Select all

var
  i: integer;
begin
  OraQuery1.Open;
  for i := 0 to OraQuery1.FieldCount - 1 do
    ShowMessage('FieldName  = ' + OraQuery1.Fields[i].FieldName + #13 +
                'FieldClass = ' + OraQuery1.Fields[i].ClassName);
end;

Re: How can I find the true database field type

Posted: Wed 05 Sep 2012 07:28
by sinys

Code: Select all

create table TEMP1
(
  a LONG RAW,
  b BLOB,
  c CLOB,
  d NCLOB
);
/

select * from TEMP1
In DBGrid I see (blob), (hugeblob), (hugeclob) and (hugeclob)
how I can find in OraQuery what "A" it is LONG RAW in db and "B" it is BLOB in db and how to distinguish "c" and "d" datatypes in ODAC (CLOB and NCLOB)?

Re: How can I find the true database field type

Posted: Wed 05 Sep 2012 14:08
by bork
To get real DB field types you can use the TOraMetaData component:

Code: Select all

begin
  OraMetaData1.MetaDataKind := 'Columns';
  OraMetaData1.Restrictions.Clear;
  OraMetaData1.Restrictions.Add('TABLE_NAME=TEMP1');
  OraMetaData1.Open;
end;