|
原帖由 〇〇 于 2009-7-10 14:33 发表 ![]()
我更希望c能产生从基层表产生汇总表的1个或多个sql语句(优化后的),然后sql丢给oracle执行,
比如:
create table lt_679
as
select
substr(a.m4,1,2)dzm ,substr(a.m22,1,2)hy ,
sum (case when substr(b.m22,1,2)='63' then 1 end) cnt_63,
sum (case when substr(b.m22,1,2)='63' then b.m40 end) c2,
sum (case when substr(b.m22,1,2)='63' then c.m11 end) c3,
sum (case when substr(b.m22,1,2)='63' then c.m13 end) c4,
sum (case when substr(b.m22,1,2)='63' then c.m17 end) c5,
sum (case when substr(b.m22,1,2)='63' then c.m18 end) c6,
sum (case when substr(b.m22,1,2)='63' then c.m15 end) c7,
sum (case when substr(b.m22,1,2)='63' then c.m4 end) c8,
sum (case when substr(b.m22,1,2)='65' then 1 end) cnt_65,
sum (case when substr(b.m22,1,2)='65' then b.m40 end) c10,
sum (case when substr(b.m22,1,2)='66' then 1 end) cnt_66,
sum (case when substr(b.m22,1,2)='66' then b.m40 end) c18,
sum (case when substr(b.m22,1,2)='67' then 1 end) cnt_67,
sum (case when substr(b.m22,1,2)='67' then b.m40 end) c29
from
pjpdata.v_8600000002008032207000015 a,
pjpdata.v_8600000002008032207000016 b,
pjpdata.v_8600000002008032207000017 c
where b.m43=a.m1 and substr(b.m22,1,2)in('63','65','66','67') and b.m1=c.m1(+)
group by substr(a.m4,1,2) ,substr(a.m22,1,2);
create or replace function dl2ml(hy in varchar)
return varchar
as
x varchar(2);
begin
select
case
when hy >='01' and hy='06' and hy='13' and hy='44' and hy='47' and hy='51' and hy='60' and hy='66' and hy='68' and hy='72' and hy='73' and hy='75' and hy='79' and hy='82' and hy='84' and hy='85' and hy='88' and hy='93' and hy
要是我,就设计一个语法,然后动态生成模板,剩下的事交给DAU去做,毕竟,过去写了那么多代码,资源要利用一下。
对于你,先设计一个模式化的 词法-SQL语句 接口转换器,然后 设计一个自由语法-模式化词法的编译/解释器。
目的是让不懂程序的业务人员能够按照他们的习惯和语言自由定义处理逻辑和展示结果。OLAP对处理时间要求不太苛刻,这个实现完全可能。当然你的模式化词法要偏重于OLAP。
所以,到现在我们知道了,DAU,就是一个C语言环境下的 SQL模式化词法处理器的样本。使用DAU并不重要,重要的是,我们知道了,有一种办法,能够把一些单词组装成SQL语句,而且效率不低(我在做OLTP,所以必须立即执行,如果OLAP,可以交给其它对象执行)。大家可以用自己合适的语言写贴近用户的功能。
我是抛砖引玉,欢迎大家拍砖,更希望引玉,如交流一下如何构建词法,如何处理单词,如何形成语法和语言?
讨论了这么久,终于OO在416楼道出问题的终极目的。
[ 本帖最后由 yulihua49 于 2009-7-12 10:21 编辑 ] |
|