我正在尝试定义要用于Oracle数据库的$ queryString。我还需要能够将某些查询与||连接起来运营商。我认为问题是Powershell将其视为管道运营商。我也试过以\ |的形式使用转义和''|但似乎都不起作用。供参考,这是我正在使用的查询。
$queryString = 'select v.npa || v.calling_number phone_number, v.location, v.customer_name '
$queryString += 'from voip_validate v '
$queryString += 'left outer join phone_numbers p '
$queryString += 'on v.npa || v.calling_number = p.area_code || p.phone_prefix || p.phone_suffix '
$queryString += 'left outer join mv_dps_buildings b '
$queryString += 'on b.dps_building_number = p.dps_building_number '
$queryString += 'where p.area_code is null '
$queryString += 'and p.phone_prefix is null '
$queryString += 'and p.phone_suffix is null; '
答案 0 :(得分:3)
使用here-string
(http://technet.microsoft.com/en-us/library/ee692792.aspx):
$queryString = @'
select v.npa || v.calling_number phone_number, v.location, v.customer_name
from voip_validate v
left outer join phone_numbers p
on v.npa || v.calling_number = p.area_code || p.phone_prefix || p.phone_suffix
left outer join mv_dps_buildings b
on b.dps_building_number = p.dps_building_number
where p.area_code is null
and p.phone_prefix is null
and p.phone_suffix is null;
'@
PS>$queryString
select v.npa || v.calling_number phone_number, v.location, v.customer_name
from voip_validate v
left outer join phone_numbers p
on v.npa || v.calling_number = p.area_code || p.phone_prefix || p.phone_suffix
left outer join mv_dps_buildings b
on b.dps_building_number = p.dps_building_number
where p.area_code is null
and p.phone_prefix is null
and p.phone_suffix is null;