这是我写好的代码,
text to ggmc noshow
select jgid,行政职务,姓名 from gz02 where LEN(jgid)=9 and RIGHT(jgid,3)='000'
and (行政职务='理事长' or 行政职务='主任' or 行政职务='监事长' or 行政职务='副主任')
order by jgid
ENDTEXT
select 0
if use_("gz02",ggmc)>1
wait_("0人员表打不开")
return '0获取数据失败'
ENDIF
copy TO temp_("Gz02tmp")
USE in Gz02
select 0
if use_(temp_("Gz02tmp"))>1
wait_("0人员行政表打不开")
return '0获取数据失败'
ENDIF
select gz02tmp
select JGID,;
CASE WHEN 行政职务 = '理事长' Then 姓名
end as 理事长,;
CASE WHEN 行政职务 = '监事长' then 姓名
end as 监事长,;
CASE WHEN 行政职务 = '主任'
then 姓名
end
as 主任,;
space(10) as 副主任,;
space(10) as 副主任1,;
space(10) as 副主任2,;
space(10) as 副主任3,;
space(10) as 副主任4 from gz02tmp
group by jgid into DBF temp_("TBJSZ")
select 0
if use_(temp_("TBJSZ"))>1
wait_("00人员行政表打不开")
return '0获取数据失败'
ENDIF
CREATE CURSOR XZZW (JGID C(20),副主任 C(10),副主任1 C(10),副主任2 C(10),副主任3 C(10),副主任4 C(10))
select Gz02tmp
select * from ALIAS() where 行政职务='副主任' into dbf temp_("FZR")
select 0
if use_(temp_("FZR"))>1
wait_("0人员行政表打不开")
return '0获取数据失败'
ENDIF
select FZR
SELECT
JGID
FROM ALIAS() GROUP BY JGID INTO ARRAY AREC
FOR I=1 TO ALEN(AREC,1)
SELECT 姓名 FROM FZR
where jgid = AREC(i,1)
INTO ARRAY ASS
SELECT("XZZW")
append BLANK
REPLACE JGID With AREC(I,1)
FOR I1=2 TO FCOUNT("XZZW")-(FCOUNT("XZZW")-ALEN(ASS,1))+1
REPLACE RECORD RECCOUNT() (Field(I1)) With ASS(I1-1,1)
ENDFOR
ENDFOR
SELECT TBJSZ
APPEND FROM XZZW
BROW
但是CASE WHEN 部分总报错,“Command contains unrecognized phrase/keyword.”命令无法识别!!!但是在PLSQL执行就可以!大家帮忙看看,这样写是否对?还有帮我解释下CSAE
WHEN 语句错在哪了,因为以前也这样写过,但没报错!
[
本帖最后由 hyhosd 于 2012-8-29 11:26 编辑 ]