SQL Plus的新增功能,对迭代和函数如何使用它有些困惑。希望有人可以向我展示如何使用以下脚本进行操作:
set embedded on
set echo off
set colsep,set pagesize 0
set linesize 1000
set numwidth 10
set headsep off
spool <my_file_path>.csv;
select * from (select /*csv*/ row_number() over (order by t.objectid) as id,t.objectid as transformer_id,t.gps_x as lon,t.gps_y as lat,s.electricmeternumber,s.serviceindex,s.accountnumber,case
when t.phasedesignation = 0 then 'unknown'
when t.phasedesignation = 1 then 'C'
when t.phasedesignation = 2 then 'B'
when t.phasedesignation = 3 then 'BC'
when t.phasedesignation = 4 then 'A'
when t.phasedesignation = 5 then 'AC'
when t.phasedesignation = 6 then 'AB'
when t.phasedesignation = 7 then 'ABC'
end as phase_designation
from mvtransformer t,vservicepoint_meterinfo s
where t.objectid = s.transformerobjectid) where id > some value x and id <= some value x;
spool off;
所以我要做的是重复此脚本多次,每次更改x和文件路径。在SQL Plus中执行此操作的最佳方法是什么?
谢谢!