0

我正在尝试定义一个用于 Oracle 数据库的 $queryString。我还需要能够将一些查询与 || 连接起来。操作员。我认为的问题是 Powershell 将其视为 Pipeline 运算符。我也尝试过以 \| 的形式使用转义符。和''| 但似乎都不起作用。作为参考,这是我正在使用的查询。

$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; '
4

1 回答 1

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;
于 2013-01-23T15:05:21.500 回答