Use an encryption key to encrypt table data.

Syntax

SELECT
  ENCRYPT (column_name, encryption_key, 'password')
  FROM SYSTEM.DATABASE.SCHEMA.TABLE;

Arguments

  • column_name - column name in following table

  • encryption_key - title of encryption key.

  • ‘password’ - supply password for encryption key if it was set when created.

  • FROM OBJECT - the table containing the column.

Examples

Encrypt

SELECT ENCRYPT(surname, my_key, 'mypassword') from Ora1.fullname
``

Create a table with specified encrypted columns from a source table.

```sql
create table
  mydatabase.postgres.public.mytable_mask as
  SELECT
    encrypt(name, demokey) AS name,
    encrypt(surname, demokey, 'baggins') AS surname,
    encrypt(ssn, demokey, 'baggins') AS ssn
  FROM mydatabase.postgres.public.mytable;

See Also