SELECT dict_name FROM sys_dictionary WHERE dict_type = 'gateway' and dict_code = beg.gateway_type
这一条作为子查询时出现syntax error at end of input
错误
百度一下是因为参数为空导致的, beg.gateway_type
这个是左连接的右表, 所以的确可能为空.
于是我加了一个判断, 改为:
CASE WHEN gateway_type is not null THEN (SELECT dict_name FROM sys_dictionary WHERE dict_type = 'gateway' and dict_code = beg.gateway_type) ELSE null END as gateway_typename
就好了