DECLARE temp_sql varchar(100);temp_sql='第一行
          第二行
          第三行';
在MySQL中不使用CONCAT及其它的连接函数来实现上面的结构啊,主要是为了看的清楚些.

解决方案 »

  1.   

    mysql> set @xx='abc
        '> def
        '> fgh';
    Query OK, 0 rows affected (0.00 sec)mysql> select @xx;
    +-------------+
    | @xx         |
    +-------------+
    | abc
    def
    fgh |
    +-------------+
    1 row in set (0.00 sec)mysql>似乎可以啊。
      

  2.   

    Temp_sql分三行显示,不行吧,
    concat('123',char(13),char(10),'456')
    导出来后可以分三行显示
      

  3.   

    因为我在写存储过程不是在命令行下这个语句一大串SQL语句,所以要分多行显示这样SQL看的清晰些啊
      

  4.   

    同样存储过程中也可以啊。mysql> delimiter //
    mysql>
    mysql> CREATE PROCEDURE simpleproc ()
        -> BEGIN
        -> declare temp_sql varchar(100);
        ->
        -> set temp_sql='第一行
        '>           第二行
        '>           第三行';
        -> select temp_sql;
        ->
        -> END;
        -> //
    Query OK, 0 rows affected (0.00 sec)mysql>
    mysql> delimiter ;
    mysql>
    mysql> CALL simpleproc();
    +------------------------------------------+
    | temp_sql                                 |
    +------------------------------------------+
    | 第一行
              第二行
              第三行 |
    +------------------------------------------+
    1 row in set (0.00 sec)Query OK, 0 rows affected (0.00 sec)mysql>
      

  5.   

    测试了一下,在命令行下可以显示出来,
    set ff=CONCAT('123',CHAR(13),CHAR(10),')456','789');
    select ff;