【问题标题】:MySQL extratvalue range, output and parsing issuesMySQL extratvalue 范围、输出和解析问题
【发布时间】:2012-12-01 14:01:08
【问题描述】:

我正在学习 MySQL。我的查询如下:
mysql>select extractvalue(1,1111111111111111111); // 19 个 1。 输出:

`+-------------------------------------+
 | extractvalue(1,1111111111111111111) |
 +-------------------------------------+
 | 1111111111111111111                 |
 +-------------------------------------+
1 row in set (0.00 sec)`

但是对于 20 个 1

mysql>select extract(1,11111111111111111111);
+--------------------------------------+
| extractvalue(1,11111111111111111111) |
+--------------------------------------+
| -7335632962598440505                 |
+--------------------------------------+
1 row in set (0.00 sec)

以下显示了不同的错误:

mysql> select extractvalue(rand(),5.5.28));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '.28))
' at line 1
mysql> select extractvalue(rand(),version());
ERROR 1105 (HY000): XPATH syntax error: '.28'

谁能解释一下?

【问题讨论】:

    标签: mysql xpath syntax extract-value


    【解决方案1】:

    这些我都试过了,好像行得通。

    SELECT @rand := RAND();
    
    select extractvalue(1,@rand);
    

    但是,extract 似乎不起作用并给出了错误。无论哪种方式,我都没有设法使用extractextractvalue 来包装rand()。原因可能是 extractvalue 只返回 CDATA。此功能似乎不支持您的申请意图。它用于 XPATH

    例如

    Select allhttp://www.blablabla.com/error.php?id=null 
    and extractvalue(rand(),concat(0x3a,(
    select concat(0x3a,username,0x3a,password) from users)))
    

    觉得这很有趣:reference

    【讨论】:

    • 感谢您的参考。但是我还是不太明白。
    猜你喜欢
    • 1970-01-01
    • 2019-06-17
    • 1970-01-01
    • 2020-04-23
    • 2021-09-25
    • 1970-01-01
    • 1970-01-01
    • 2014-12-28
    • 2012-04-13
    相关资源
    最近更新 更多