something like this:

insert into EmailSubscription (
    Email,
    IsSubscribed,
    DateSubscribed,
    SubCode
)
values (
    "[email protected]",
    true,
    current_timestamp(),
    rawtohex(hash('SHA256', concat("[email protected]", current_timestamp()),
1))
);


On 19 August 2017 at 07:15, Thotheolh <[email protected]> wrote:

> Hi,
>
> I am trying to run nested CALL functions but could not get it to work.
> Below is my SQL statement.
>
> insert into EmailSubscription (
>>     Email,
>>     IsSubscribed,
>>     DateSubscribed,
>>     SubCode
>> )
>> values (
>>     "[email protected]",
>>     true,
>>     current_timestamp(),
>>     call rawtohex(call hash('SHA256', call concat(Email, DateSubscribed),
>> 1))
>> );
>
>
> I want to SHA256 hash the concatenation of the email address with the
> timestamp of subscription and then convert the raw SHA256 binary output
> into a hexadecimal representation to be inserted as the 'SubCode' for the
> table.
>
> How should I go about doing that in SQL ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to