Reputation: 1
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
why user is aca?and can't find the file (c://windows//temp//test.ini)?
Upvotes: 0
Views: 2063
Reputation: 655735
SELECT … INTO …
can’t be used in a sub-query:
An
INTO
clause should not be used in a nestedSELECT
because such aSELECT
must return its result to the outer context.
That’s why MySQL chose to return the value instead of writing it into file.
Upvotes: 2