语法错误:意外的文件结束 [英] syntax error: unexpected end of file

查看:358
本文介绍了语法错误:意外的文件结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SQL查询,当它摆在它停止这种语法错误工作的函数:文件错误消息的意外结束。从函数删除它使其重新开始工作。

这是为什么?

 功能pull_data
{
    sqlplus的-s $ USER / $ @通$ DB<< EOF
    SELECT DISTINCT ORDER_NUMBER,
                    order_total_items,
                    order_total_value
    从接单    WHERE order_date的BETWEEN'$ 1'和'$ 2';    出口;    EOF
}


解决方案

缩进的定界符分隔符打破它。你说:

  EOF

而不是

  EOF

I have an SQL query that when it is put in to a function it stops working with this syntax error: unexpected end of file error message. Removing it from a function causes it to start working again.

Why is this?

function pull_data
{
    sqlplus -s $user/$pass@$db << EOF
    SELECT DISTINCT order_number,
                    order_total_items,
                    order_total_value
    FROM orders

    WHERE order_date BETWEEN '$1' AND '$2';

    exit;

    EOF
}

解决方案

The indented heredoc delimiter breaks it. Say:

EOF

instead of

    EOF

这篇关于语法错误:意外的文件结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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