Skip to main content

numeric

Function numeric 

Source
pub fn numeric(value: Decimal, precision: u8, scale: u8) -> Numeric
Expand description

Create a decimal/numeric parameter with explicit precision and scale.

Required when binding to an Always Encrypted decimal column, whose declared decimal(precision, scale) must match the column exactly.

The value is rescaled to scale, which rounds when the value has more fractional digits than scale (e.g. numeric(dec!(12.999), 18, 2) stores 13.00). If the rescaled value has more significant digits than precision, ToSql::to_sql returns an error rather than silently storing a value outside the column’s domain — the server cannot range-check an encrypted value, so the client enforces it.