TOracleDirectPathLoader: Another Question about number field

windnet

Member
If the number Column has no scale, such as number(10), it seems the result is 0, not the actual value set by SetData().
How to resolve this problem?

Thanks for any help!
 
Last edited:
By default a number(10) column is represented by a Double in Delphi, so you will need to pass a Double value instead of an Integer value.
 
Thanks for your help.
But I have passed Double value to SetData, and still have the same problem.

If I change CaseNo field from NUMBER(8) to NUMBER(9,1), it works. But we will need to change many tables and storeProcedure if we have to do it like this.

Oracle 9i, C++ Builder 6.0.

Sample Code:

create table TEST_TABLE1
(
CASENO NUMBER(8)
);

OracleSession1->LogOn();
DataLoader->TableName = "test_table1";
DataLoader->GetDefaultColumns(false);
DataLoader->Prepare();

AnsiString fieldName = "CaseNo";
int Row = 0;
double caseValue = 7;
int count = 3;

for (int i=0; i< count ; i++)
{
TDirectPathColumn *pColumn = DataLoader->ColumnByName(fieldName);
int ColType = pColumn->DataType;
switch(ColType)
{
case dpString:
pColumn->SetData(Row, NULL, 0);
break;
case dpInteger:
pColumn->SetData(Row, &caseValue, 0);
break;
case dpFloat:
pColumn->SetData(Row, &caseValue, 0);
break;
default:break;
}
Row++;
}
if (Row == count)
{
try
{
DataLoader->Load(Row);
}
catch (EOracleError &E)
{
ShowMessage(E.Message + "\n\n" +
"Row = " + IntToStr(DataLoader->LastRow) + ", " +
"Col = " + IntToStr(DataLoader->LastColumn));
DataLoader->Abort();
}
}
DataLoader->Finish(); // Commit the loaded data
OracleSession1->LogOff();
 
Last edited:
This part is incorrect:

Code:
case dpInteger:
  pColumn->SetData(Row, &caseValue, 0);
  break;
case dpFloat:
  pColumn->SetData(Row, &caseValue, 0);
  break;

If caseValue is a Double, then it cannot be passed to a dpInteger column. The TDirectPathColumn->DataType must match the actual data type.
 
Last edited:
Back
Top