MySQL的插入不能与选择成outfile? [英] mysql insert can't with select into outfile?

查看:70
本文介绍了MySQL的插入不能与选择成outfile?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mysql> insert into helpme set user=(select 0x616361 into outfile 'c://windows//temp//test.ini');
Database changed

mysql> select * from helpme;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+
| user                                                                                                                                                                                                                                    | id    |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+
| a                                                                                                                                                                                                                                       |     1 |                                                                                                                                                                                                                                  | 37833 |
| aca                                                                                                                                                                                                                                     | 37834 |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+
2 rows in set

为什么用户是aca?找不到文件(c://windows//temp//test.ini)?

why user is aca?and can't find the file (c://windows//temp//test.ini)?

推荐答案

SELECT … INTO … can’t be used in a sub-query:

不应在嵌套的SELECT中使用INTO子句,因为这样的SELECT必须将其结果返回到外部上下文.

An INTO clause should not be used in a nested SELECT because such a SELECT must return its result to the outer context.

这就是为什么MySQL选择返回值而不是将其写入文件的原因.

That’s why MySQL chose to return the value instead of writing it into file.

这篇关于MySQL的插入不能与选择成outfile?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆