我需要将db值转换为base64encode。我试过了:
select encode(cast(est_name as text),'base64') from establishments;
显示错误
[SQL]select encode(string(cast(est_name as text)),'base64') from establishments;
[Err] ERROR: function string(text) does not exist
LINE 1: select encode(string(cast(est_name as text)),'base64') from ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
我哪里错了?请帮忙。提前谢谢
答案 0 :(得分:9)
encode
函数从bytea编码为文本。
select encode(est_name::bytea, 'base64')
from establishments;