Function getJYSCode(stockID);
Begin
//-只郑商所 有区别
if spec(base(703027),stockID)='郑州商品交易所' then
return stockID[1:length(stockID)-4]+stockID[length(stockID)-2:];
else return stockID;
End;
再在使用时进行调用该函数:
// 获取国内商品期货的交易所代码
stocks:=getbk('国内商品期货'); //当前正在交易的
//加入已退市的商品期货
stocks:=stocks union2 sselect thisrow from getbk('退市期货') where spec(base(703028),thisrow)='商品期货' end;
return select thisrow as 'TSCode',getJYSCode(thisrow) as '交易所代码'
from stocks end;