Db2

 View Only
Expand all | Collapse all

How to Base64 Enode Column in SQL Statement?

  • 1.  How to Base64 Enode Column in SQL Statement?

    Posted Thu January 19, 2023 12:32 PM
    I have a column in a table that's I'd like to query and return as BASE64Encoded.  Is there a way to do this?

    SELECT BASE64ENCODE(column) AS Base64Encoded
    FROM table;

    I'm a newbie to DB2(z/OS).

    ------------------------------
    Kurt Shull
    ------------------------------


  • 2.  RE: How to Base64 Enode Column in SQL Statement?

    Posted Mon January 30, 2023 09:27 AM

    Yes, you can query a column and return it as a BASE64 encoded value using the SELECT statement with the BASE64ENCODE function. The syntax you provided is correct, and it would look like this:

    SELECT BASE64ENCODE(column) AS Base64Encoded FROM table;

    Please note that the BASE64ENCODE function is not a standard SQL function, it may not be supported by DB2(z/OS) or any other DBMS. However, you can use similar function to achieve this or use some external library to get the base64 encoded value of the column.



    ------------------------------
    Uma Sajit
    ------------------------------