Created
          July 10, 2013 16:37 
        
      - 
      
- 
        Save jpetitcolas/5967887 to your computer and use it in GitHub Desktop. 
    Encode/decode a base64 encoded string in PostGreSQL
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- Decoding | |
| SELECT CONVERT_FROM(DECODE(field, 'BASE64'), 'UTF-8') FROM table; | |
| -- Encoding | |
| SELECT ENCODE(CONVERT_TO(field, 'UTF-8'), 'base64') FROM table; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Thank you ! it was helpful.