Small Integer UDFs

pty_smallintenc

This UDF protects the small integer value using an Encryption data element.

Signature:

pty_smallintenc(col SMALLINT, dataelement VARCHAR, resultlen INTEGER, communicationidINTEGER, scid INTEGER)

Parameters:

NameTypeDescription
colSMALLINTSpecifies the data to protect.
dataelementVARCHARSpecifies the name of the data element.
resultlenINTEGERSpecifies the length of the buffer to hold the result.
communicationidINTEGERSpecify the value as 0. This parameter is deprecated.
scidINTEGERSpecify the value as 0. This parameter is deprecated.

Returns:
The function returns the protected VARBYTE value.

Exception:
If the user does not have protect access rights in the policy, then the UDF terminates with an error message explaining what went wrong.

Example:

select pty_smallintenc(12345,'AES256',100,0,0);

pty_smallintdec

This UDF unprotects the small integer value.

Signature:

pty_smallintdec(col VARBYTE, dataelement VARCHAR, communicationid INTEGER, scid INTEGER)

Parameters:

NameTypeDescription
colVARBYTESpecifies the data to unprotect.
dataelementVARCHARSpecifies the name of the data element.
communicationidINTEGERSpecify the value as 0. This parameter is deprecated.
scidINTEGERSpecify the value as 0. This parameter is deprecated.

Returns:

  • The function returns an unprotected SMALLINT value.
  • The function returns NULL when the user has no access to the data in the policy.

Exception:
If you configure an exception in the policy and the user does not have access, then the UDF terminates with an error message explaining what went wrong.

Example:

select pty_smallintdec(pty_smallintenc(12345,'AES256',100,0,0),'AES256',0,0);

pty_smallintdecex

This UDF unprotects the protected small integer value.

Signature:

pty_smallintdecex(col VARBYTE, dataelement VARCHAR, communicationid INTEGER, scid INTEGER)

Parameters:

NameTypeDescription
colVARBYTESpecifies the data to unprotect.
dataelementVARCHARSpecifies the name of the data element.
communicationidINTEGERSpecify the value as 0. This parameter is deprecated.
scidINTEGERSpecify the value as 0. This parameter is deprecated.

Returns:

  • The function returns an unprotected SMALLINT value.
  • The function returns an error instead of NULL if the user does not have access

Exception:
If you configure an exception in the policy and the user does not have access, then the UDF terminates with an error message explaining what went wrong.

Example:

select pty_smallintdecex(pty_smallintenc(12345,'AES256',100,0,0),'AES256',0,0);

pty_smallintins

This UDF protects the small integer value using type-preserving data elements, such as, tokens and No Encryption for access control.

Signature:

pty_smallintins(col SMALLINT, dataelement VARCHAR, resultlen INTEGER, communicationid INTEGER, scid INTEGER)

Parameters:

NameTypeDescription
colSMALLINTSpecifies the data to protect.
dataelementVARCHARSpecifies the name of the data element.
resultlenINTEGERSpecifies the length of the buffer to hold the result.
communicationidINTEGERSpecify the value as 0. This parameter is deprecated.
scidINTEGERSpecify the value as 0. This parameter is deprecated.

Returns:
The function returns the protected SMALLINT value.

Exception:
If you configure an exception in the policy and the user does not have access, then the UDF terminates with an error message explaining what went wrong.

Example:

select pty_smallintins(12345, 'TE_INT_2', 100, 0,0);

pty_smallintsel

This UDF unprotects the small integer value using type-preserving data elements, such as, tokens and No Encryption for access control.

Signature:

pty_smallintsel(col SMALLINT, dataelement VARCHAR, communicationid INTEGER, scid INTEGER)

Parameters:

NameTypeDescription
colSMALLINTSpecifies the data to unprotect.
dataelementVARCHARSpecifies the name of the data element.
communicationidINTEGERSpecify the value as 0. This parameter is deprecated.
scidINTEGERSpecify the value as 0. This parameter is deprecated.

Returns:

  • The function returns the unprotected SMALLINT value.
  • The function returns the protected value if this option is configured in the policy and the user does not have access to the data.
  • The function returns NULL when the user has no access to the data in the policy.

Exception:
If you configure an exception in the policy and the user does not have access, then the UDF terminates with an error message explaining what went wrong.

Example:

select pty_smallintsel(pty_smallintins(12345, 'TE_INT_2', 100, 0,0), 'TE_INT_2',0,0);

pty_smallintselex

This UDF unprotects the protected small integer value.

Signature:

pty_smallintselex(col SMALLINT, dataelement VARCHAR, communicationid INTEGER, scid INTEGER)

Parameters:

NameTypeDescription
colSMALLINTSpecifies the data to unprotect.
dataelementVARCHARSpecifies the name of the data element.
communicationidINTEGERSpecify the value as 0. This parameter is deprecated.
scidINTEGERSpecify the value as 0. This parameter is deprecated.

Returns:

  • The function returns the SMALLINT value.
  • The function returns the protected value if this option is configured in the policy and the user does not have access to the data.

Exception:
If you configure an exception in the policy and the user does not have access, then the UDF terminates with an error message explaining what went wrong.

Example:

select pty_smallintselex(pty_smallintins(12345, 'TE_INT_2', 100, 0,0), 'TE_INT_2',0,0);

pty_smallinthash

This UDF calculates the hash value for a SMALLINT value. This is a one-way function and you cannot unprotect the data.

Signature:

pty_smallinthash(col SMALLINT, dataelement VARCHAR, resultlen INTEGER, communicationid INTEGER, scid INTEGER)

Parameters:

NameTypeDescription
colSMALLINTSpecifies the data to protect.
dataelementVARCHARSpecifies the name of the data element.
resultlenINTEGERSpecifies the length of the buffer to hold the result.
communicationidINTEGERSet the value of the parameter to zero.
Note: This parameter is no longer used and is retained for compatibility purposes only.
scidINTEGERSpecifies the security co-ordinate ID. Set the value of the parameter to zero.
Note: This parameter is no longer used and is retained for compatibility purposes only.

Returns:
The function returns the hash value.

Exception:
If you configure an exception in the policy and the user does not have access rights, then the UDF terminates with an error message explaining what went wrong.

Example:

select PTY_SMALLINTHASH(1234, 'HMAC_SHA256', 100, 0,0);

Last modified : February 20, 2026