oracle测试表结构及数据
oracle sqr代码
示例代码输出结果
小结
osibank.testzxysqr a b 1 1 2 3 2 3 3 4 4 6 6 9 |
oracle sqr代码
#define addtlsetup #include 'Rptstub.lib' #include '{libpath}tkit_batchstartup.inc' !#include '{libpath}tkit_rptheader.inc' #include '{libpath}tkit_queappl.inc' #include '{libpath}tkit_vars_opts.inc' #include '{libpath}tkit_Sqrfunc.inc' begin-setup Declare-layout batch-land rientation=landscape left-margin=0 top-margin=0 max-lines=60 max-columns=180 end-declare end-setup !20111220 newly added 无数据使用报表头 begin-heading 5 name=nodataheading print 'a列' (1,11) print 'b列' (1,20) print '─' (+1,2,84) fill end-heading begin-procedure osi-main do group_a end-procedure begin-procedure query_table($a) begin-select position (+1) a &a1 move &a1 to $a1 print $a1 (,20,10) edit 9 b &b1 move &b1 to #b1 print #b1 (,40,10) edit 9 from osibank.zxytestsqr z where z.a=$a end-select end-procedure !以分组a列输出不同的lis文件 begin-procedure group_a begin-select distinct !to_char(a) &a () on-break print=never after=group($a) save=$a a &a () on-break print=never after=group($a) save=$a !after及before只能用于begin-select节中 from osibank.zxytestsqr order by a!p.branchorgnbr &a () ON-BREAK PRINT=NEVER AFTER=NP($a) save = $a end-select end-procedure begin-procedure group($a) !如下new-report与do语句的先后顺序至关重要,开始do语句在前,产生的分组lis文件会少1个,调换2语句顺序后,产生分组LIS文件正常 let $out=$a||'_'||'查询.lis' new-report $out !此new-report语句 do query_table($a) !此do语句 end-procedure begin-procedure OSI-Startup End-procedure begin-footing 5 !name=endfooting !报表尾打印位置要注意,不然可能会出现当前页没打印输出完,就会打印第二页报错,调整position即可 page-number (+1,20) '当前页为第' '页,' last-page () '共' '页。' end-footing |
示例代码输出结果
依次产生6个LIS文件: 1_查询.lis 2_查询.lis 3_查询.lis 4_查询.lis 5_查询.lis 6_查询.lis 其上述lis文件内容,摘1_查询.lis,其它LIS类同 1 3 |
小结
1,sqr命令,一定要仔细理解,比如NEW-REPORT与do命令的顺序 |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-713645/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-713645/