【问题标题】:How do I display a field's hidden characters in the result of a query in H2?如何在 H2 的查询结果中显示字段的隐藏字符?
【发布时间】:2011-03-02 17:52:05
【问题描述】:

我在 h2 数据库中有一个 varchar 字段,我希望能够看到其中的每个字符(包括换行符和回车等特殊字符)。

基本上,我需要知道 Oracle's dump() 的 h2 等价物。

【问题讨论】:

    标签: database h2


    【解决方案1】:

    rawtohex() 有效,但stringencode() 可能更简单,因为它返回 Java 编码字符串:

    select rawtohex('test' || char(13) || char(444));
    > 0074006500730074000d01bc
    
    select stringencode('test' || char(13) || char(444));
    > test\r\u01bc
    

    【讨论】:

      【解决方案2】:

      我应该一直在寻找。在h2 documentation: rawtohex() 中找到它。

      【讨论】:

        猜你喜欢
        • 2020-12-11
        • 2017-06-06
        • 2022-01-08
        • 2023-03-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-03-18
        • 1970-01-01
        相关资源
        最近更新 更多