DB2 10.5 for Linux, UNIX, and Windows

DB2DecimalFloat Structure

Represents the DECFLOAT(16|34) DB2® data type. DB2DecimalFloat instances contain floating-point decimal values.

Namespace:
IBM.Data.DB2Types
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax

[Visual Basic]
Public Structure DB2DecimalFloat
[C#]
public struct DB2DecimalFloat
[C++]
public value class DB2DecimalFloat

Remarks

The DB2DecimalFloat structure represents an exact decimal value with floating scale. The maximum of 34 significant digits are stored with complete accuracy.

You can obtain a DB2DecimalFloat value using the DB2DataReader.GetDB2DecimalFloat or DB2ResultSet.GetDecimalFloat methods. This data type corresponds directly to the DECFLOAT data type that is used by the following servers:
  • DB2 for z/OS® server
  • DB2 for Linux, UNIX, and Windows server
  • DB2 for i V6R1 and later

The DB2DecimalFloat class can store values with the precision set to 34 and can also store values from a DECFLOAT declared with the precision of 16.

Example

[C#] The following example demonstrates how to retrieve a single DECFLOAT column value from a table.

[C#]
  public static string getParam(DB2Connection conn)
  {
    string mySelectQuery = "SELECT DECIMALFLOATCOL FROM TESTTABLE";
    DB2Command myCommand = new DB2Command(mySelectQuery, conn);
    DB2DataReader reader = myCommand.ExecuteReader();

    if (reader.Read())
    {
      DB2DecimalFloat selectValue = reader.GetDB2DecimalFloat(11);

      if (!selectValue.IsNull) { return selectValue.ToString(); }
    }

    return "NULL";
  }

Thread safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.