Example showing how to encrypt a column

You can use the SET ENCRYPTION PASSWORD statement to restrict access to data in a column.

The following example shows how to use the encryption password in a column that contains a social security number:

create table emp
(   name char(40),
    salary money,
    ssn lvarchar(67)
    );
        set encryption password "one two three 123";
        insert into emp values ("Alice", 50000, encrypt_aes
('123-456-7890'));
        insert into emp values ("Bob", 65000, encrypt_aes
('213-656-0890'));
        select name, salary, decrypt_char(ssn, "one two three 123")
 from emp where name = 'Bob';