Decimal UDFs

Decimal UDFs in Trino

This section provides a list of the Decimal UDFs for the protect, unprotect, and reprotect operations. Ensure to use the data element with the No Encryption method only. Using any other data element might cause data corruption.

ptyProtectDecimal()

This UDF protects the Decimal value.

Signature:

ptyProtectDecimal(decimal input, varchar dataElement)

Parameters:

NameTypeDescription
inputDecimalSpecifies the data to protect.
dataElementVarCharSpecifies the name of the data element to protect the data.

Returns:
This UDF returns the protected Decimal value. If the input value is NULL and the data element is not a part of the policy, then the output value returned is NULL.

Example:

select ptyProtectDecimal(12332212222223.033, 'NoEnc');

Supported Protection Methods:

Function NameTokenizationEncryptionFPENo EncryptionMaskingMonitoring
ptyProtectDecimal()NoNoNoYesNoYes

ptyUnprotectDecimal()

This UDF unprotects the protected Decimal value. Ensure to use the data element with the No Encryption method only. Using any other data element might cause data corruption.

Signature:

ptyUnprotectDecimal(decimal input, varchar dataElement)

Parameters:

NameTypeDescription
inputDecimalSpecifies the protected data to unprotect.
dataElementVarCharSpecifies the name of the data element to unprotect the data.

Returns:
This UDF returns the unprotected Decimal value. If the input value is NULL and the data element is not a part of the policy, then the output value returned is NULL.

Example:

select ptyUnprotectDecimal(12332212222223.033, 'NoEnc');

Supported Protection Methods:

Function NameTokenizationEncryptionFPENo EncryptionMaskingMonitoring
ptyUnprotectDecimal()NoNoNoYesNoYes

ptyReprotect() - Decimal

This UDF reprotects the Decimal format protected data, which was earlier protected using the ptyProtectDecimal() UDF, with a different data element.

Signature:

ptyReprotect(decimal input, varchar oldDataElement, varchar newDataElement)

Parameters:

NameTypeDescription
inputDecimalSpecifies the Decimal value to reprotect.
oldDataElementVarCharSpecifies the name of the data element that was initially used to protect the data.
newDataElementVarCharSpecifies the name of the new data element to reprotect the data.

Returns:
This UDF returns the protected Decimal value.

Example:

select ptyReprotect(12332212222223.033,'NoEnc','NoEnc');

Supported Protection Methods:

Function NameTokenizationEncryptionFPENo EncryptionMaskingMonitoring
ptyReprotect() - DecimalNoNoNoYesNoYes

Last modified : December 18, 2025