Oracle 5.0 Reference Manual page 1108

Table of Contents

Advertisement

An
clause should not be used in a nested
INTO
to the outer context.
The
clause can name a list of one or more variables, which can be user-defined variables, stored
INTO
procedure or function parameters, or stored program local variables. (Within a prepared
statement, only user-defined variables are permitted;see
INTO OUTFILE
Variable Scope and
Resolution".)
The selected values are assigned to the variables. The number of variables must match the number
of columns. The query should return a single row. If the query returns no rows, a warning with error
code 1329 occurs
(No
rows, error 1172 occurs
statement may retrieve multiple rows, you can use
SELECT id, data INTO @x, @y FROM test.t1 LIMIT 1;
User variable names are not case sensitive. See
The
SELECT ... INTO OUTFILE 'file_name'
to a file. The file is created on the server host, so you must have the
use this syntax.
file_name
such as
/etc/passwd
character_set_filesystem
The
SELECT ... INTO OUTFILE
to a text file on the server machine. If you want to create the resulting file on some other host than the
server host, you normally cannot use
path to the file relative to the server host's file system.
However, if the MySQL client software is installed on the remote machine, you can instead use a client
command such as
mysql -e "SELECT ..." > file_name
It is also possible to create the resulting file on a different host other than the server host, if the location
of the file on the remote host can be accessed using a network-mapped path on the server's file
system. In this case, the presence of
the target host.
SELECT ... INTO OUTFILE
dumped using the
binary
contains columns in several character sets, the output data file will as well and you may not be able to
reload the file correctly.
The syntax for the
export_options
clauses that are used with the
Syntax", for information about the
INFILE
and permissible values.
FIELDS ESCAPED BY
character is not empty, it is used when necessary to avoid ambiguity as a prefix that precedes following
characters on output:
• The
FIELDS ESCAPED BY
• The
FIELDS [OPTIONALLY] ENCLOSED BY
• The first character of the
• ASCII
(the zero-valued byte; what is actually written following the escape character is ASCII "0",
NUL
not a zero-valued byte)
The
FIELDS TERMINATED
characters must be escaped so that you can read the file back in reliably. ASCII
make it easier to view with some pagers.
SELECT
data), and the variable values remain unchanged. If the query returns multiple
(Result consisted of more than one
cannot be an existing file, which among other things prevents files
and database tables from being destroyed. As of MySQL 5.0.19, the
[442]
system variable controls the interpretation of the file name.
statement is intended primarily to let you very quickly dump a table
SELECT ... INTO OUTFILE
(or some other MySQL client program) is not required on
mysql
is the complement of
character set. In effect, there is no character set conversion. If a result set
part of the statement consists of the same
LOAD DATA INFILE
FIELDS
controls how to write special characters. If the
character
FIELDS TERMINATED BY
BY,
ENCLOSED
BY,
1088
Syntax
because such a
SELECT
to limit the result set to a single row.
LIMIT 1
Section 9.4, "User-Defined
form of
writes the selected rows
SELECT
FILE
since there is no way to write a
to generate the file on the client host.
INFILE. Column values are
LOAD DATA
statement. See
Section 13.2.6,
and
clauses, including their default values
LINES
character
and
LINES TERMINATED BY
BY, or
ESCAPED
LINES TERMINATED BY
must return its result
SELECT
SELECT ...
Section 13.6.4.2, "Local
row). If it is possible that the
Variables".
[577]
privilege to
and
FIELDS
"LOAD DATA
FIELDS ESCAPED BY
values
is escaped to
NUL
LINES

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents