Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更正以下查询以sqlplus模式运行_Sql_Oracle_Sqlplus - Fatal编程技术网

更正以下查询以sqlplus模式运行

更正以下查询以sqlplus模式运行,sql,oracle,sqlplus,Sql,Oracle,Sqlplus,当我在shell脚本中传递此查询并通过sqlplus模式执行时,我收到一个错误,指出行数太多,因此无法执行,我们可以将查询更改为行数较少吗?是否必须为1个查询?您得到的确切错误消息是什么?你的问题-不要在评论中发布代码或附加信息。我认为“优化”不是正确的词,特别是因为这个问题与DB有关。你只有22行。我刚刚运行了一条1733行的SQL语句。很好。无论您使用什么方法将SQL传递给SQLPLUS,这都是您的限制。你需要修正这一点,因为22行对于一个查询来说并不多。你是不是将整个内容作为一行传递,然后

当我在shell脚本中传递此查询并通过sqlplus模式执行时,我收到一个错误,指出行数太多,因此无法执行,我们可以将查询更改为行数较少吗?

是否必须为1个查询?您得到的确切错误消息是什么?你的问题-不要在评论中发布代码或附加信息。我认为“优化”不是正确的词,特别是因为这个问题与DB有关。你只有22行。我刚刚运行了一条1733行的SQL语句。很好。无论您使用什么方法将SQL传递给SQLPLUS,这都是您的限制。你需要修正这一点,因为22行对于一个查询来说并不多。你是不是将整个内容作为一行传递,然后得到SP2-0027:输入太长>2499个字符-忽略行?你发布的内容略高于该限制。当然,我们不应该猜测——为什么不在您的问题中显示您得到的实际错误和您的shell脚本呢?
SELECT Sum(SumCount) AS TotalCount FROM(
SELECT COUNT(*) AS SumCount FROM IFSP01.COUNTER000
where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter001 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter002 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter003 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter004 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter005 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter006 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter007 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter008 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter009 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter010 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter011 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter012 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter013 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter014 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter015 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter016 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter017 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter018 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss') union
select count(*) from counter019 where serverid=2 and  timestamp<to_timestamp('12-06-2017 00:00:00', 'dd-mm-yyyy hh24:mi:ss'))dt;