尝试将我的访问语句转换为sql开发人员并获取更多记录然后我应该并且它要求我为B *输入替换变量请查看两个查询可以有人帮助
在ORACLE中创建
SELECT
cast(vw_GE_SUMQry.year as varchar2(4)) || '-' || substr(cast(vw_GE_SUMQry.year+1 as varchar(4)),3) YEARF
gems_cmn_location.LOCATION_ENG,
vw_ge_sumqry.srce,
GEMS_CMN_INDUSTRIES.industry,
vw_gdp_currentqry.method,
vw_gdp_currentqry.current_value,
vw_GE_SUMQry.ge_expend/vw_gdp_currentqry.current_value*0.0001 AS GEGDP
FROM gems_cmn_location INNER JOIN (vw_gdp_currentqry
INNER JOIN vw_GE_SUMQry ON vw_gdp_currentqry.LOC = vw_GE_SUMQry.LOC AND vw_gdp_currentqry.YEAR = vw_GE_SUMQry.YEAR
INNER JOIN GEMS_CMN_INDUSTRIES ON vw_gdp_currentqry.IND = GEMS_CMN_INDUSTRIES.IND)
ON gems_cmn_location = vw_gdp_currentqry.LOC
WHERE vw_gdp_currentqry.IND<>'F&B';
我需要创建
SELECT
[GE_SUMQry].[YEAR] & "-" & Right([GE_SUMQry].[YEAR]+1,2) AS YEARF,
LOCATION.LOCATION_ENG,
GE_SUMQry.SRCE,
INDUSTRIES.INDUSTRY,
[GDP_$CurrentQry].METHOD,
[GDP_$CurrentQry].[$CURRENT],
[ge_expend]/[$current]*0.0001 AS [GE%GDP]
FROM LOCATION INNER JOIN (([GDP_$CurrentQry] INNER JOIN GE_SUMQry ON ([GDP_$CurrentQry].LOC = GE_SUMQry.LOC) AND ([GDP_$CurrentQry].YEAR = GE_SUMQry.YEAR)) INNER JOIN INDUSTRIES ON [GDP_$CurrentQry].IND = INDUSTRIES.IND) ON LOCATION.LOC = [GDP_$CurrentQry].LOC
WHERE ((([GDP_$CurrentQry].IND)<>"F&B"));
答案 0 :(得分:0)
Oracle使用&
作为绑定变量的占位符,因此需要对其进行转义。您可以先调用SET ESCAPE ON
,然后将'F&B'
更改为'F\&B'
,或者如果无法调用SET,则可以使用'F' || '&' || 'B'
。
所以,要么:
SET ESCAPE ON;
SELECT
cast(vw_GE_SUMQry.year as varchar2(4)) || '-' || substr(cast(vw_GE_SUMQry.year+1 as varchar(4)),3) YEARF
gems_cmn_location.LOCATION_ENG,
vw_ge_sumqry.srce,
GEMS_CMN_INDUSTRIES.industry,
vw_gdp_currentqry.method,
vw_gdp_currentqry.current_value,
vw_GE_SUMQry.ge_expend/vw_gdp_currentqry.current_value*0.0001 AS GEGDP
FROM gems_cmn_location INNER JOIN (vw_gdp_currentqry
INNER JOIN vw_GE_SUMQry ON vw_gdp_currentqry.LOC = vw_GE_SUMQry.LOC AND vw_gdp_currentqry.YEAR = vw_GE_SUMQry.YEAR
INNER JOIN GEMS_CMN_INDUSTRIES ON vw_gdp_currentqry.IND = GEMS_CMN_INDUSTRIES.IND)
ON gems_cmn_location = vw_gdp_currentqry.LOC
WHERE vw_gdp_currentqry.IND<>'F&B';
或:
SELECT
cast(vw_GE_SUMQry.year as varchar2(4)) || '-' || substr(cast(vw_GE_SUMQry.year+1 as varchar(4)),3) YEARF
gems_cmn_location.LOCATION_ENG,
vw_ge_sumqry.srce,
GEMS_CMN_INDUSTRIES.industry,
vw_gdp_currentqry.method,
vw_gdp_currentqry.current_value,
vw_GE_SUMQry.ge_expend/vw_gdp_currentqry.current_value*0.0001 AS GEGDP
FROM gems_cmn_location INNER JOIN (vw_gdp_currentqry
INNER JOIN vw_GE_SUMQry ON vw_gdp_currentqry.LOC = vw_GE_SUMQry.LOC AND vw_gdp_currentqry.YEAR = vw_GE_SUMQry.YEAR
INNER JOIN GEMS_CMN_INDUSTRIES ON vw_gdp_currentqry.IND = GEMS_CMN_INDUSTRIES.IND)
ON gems_cmn_location = vw_gdp_currentqry.LOC
WHERE vw_gdp_currentqry.IND<>'F' || '&' || 'B';