sqlplus - 在 here-string header 之后但在行尾之前不允许有任何字符
sqlplus - No characters are allowed after a here-string header but before the end of the line
我第一次尝试使用 sqlplus 在 PowerShell 脚本中执行 Oracle 查询。我收到此错误消息:
At line:1 char:73
+ ... user/pw@RRRPRD.company.net:1521/RRRPRDC @"C:\Users\ ...
+ ~
No characters are allowed after a here-string header but before the end of the line.
它似乎指向@之后的 C:。有什么想法吗?我似乎在做连接信息 example. I get the same error when I try to do echoargs 处的操作。
这是我正在命令行测试的 powershell 代码,因为它永远挂起 运行 程序:
sqlplus user/pw@RRRPRD.company.net:1521/RRRPRDC @"C:\Users\me\Documents21\temp endToEnd\short.sql"
这是使用 powershell 5.1。有任何想法吗?我看到了 ,但是由于我正在按照上面的 link 中接受的示例进行操作,所以我不清楚它有什么问题。
替换
@"C:\Users\me\Documents21\temp endToEnd\short.sql"
具有以下任何一项:
`@"C:\Users\me\Documents21\temp endToEnd\short.sql"
"@C:\Users\me\Documents21\temp endToEnd\short.sql"
'@C:\Users\me\Documents21\temp endToEnd\short.sql'
注意:需要使用 verbatim (single-quoted) string ('...'
) is arguably the best choice here, given that the path contains no variable references; if it did, a expandable (double-quoted) string ("..."
)。
所有变体最终都会将以下字符串逐字传递给 sqlplus
,我认为这是您的意图:
@C:\Users\me\Documents21\temp endToEnd\short.sql
据推测,您正在尝试将 @
作为 逐字 参数的一部分传递给 sqlplus
- CLI 中的一个常见约定是使用@<file-path>
请求从文件中获取参数数据,而不是使用参数值本身。
但是,与其他 shell 不同的是,@
是 PowerShell 中的一个 元字符,可用于多种用途。
因此,一个 @
应该是一个 verbatim 字符在一个参数的开头必须 要么是 转义(带 `
)或 引用字符串的一部分 ,如上所示。请参阅概念性 about_Special_Characters 帮助主题。
如果 未转义 参数初始 @
后跟 "
或 '
,PowerShell 认为您正在尝试创建一个here-string,有特殊的多行语法要求;错误消息表明他们不满足。
我第一次尝试使用 sqlplus 在 PowerShell 脚本中执行 Oracle 查询。我收到此错误消息:
At line:1 char:73
+ ... user/pw@RRRPRD.company.net:1521/RRRPRDC @"C:\Users\ ...
+ ~
No characters are allowed after a here-string header but before the end of the line.
它似乎指向@之后的 C:。有什么想法吗?我似乎在做连接信息
这是我正在命令行测试的 powershell 代码,因为它永远挂起 运行 程序:
sqlplus user/pw@RRRPRD.company.net:1521/RRRPRDC @"C:\Users\me\Documents21\temp endToEnd\short.sql"
这是使用 powershell 5.1。有任何想法吗?我看到了
替换
@"C:\Users\me\Documents21\temp endToEnd\short.sql"
具有以下任何一项:
`@"C:\Users\me\Documents21\temp endToEnd\short.sql"
"@C:\Users\me\Documents21\temp endToEnd\short.sql"
'@C:\Users\me\Documents21\temp endToEnd\short.sql'
注意:需要使用 verbatim (single-quoted) string ('...'
) is arguably the best choice here, given that the path contains no variable references; if it did, a expandable (double-quoted) string ("..."
)。
所有变体最终都会将以下字符串逐字传递给 sqlplus
,我认为这是您的意图:
@C:\Users\me\Documents21\temp endToEnd\short.sql
据推测,您正在尝试将 @
作为 逐字 参数的一部分传递给 sqlplus
- CLI 中的一个常见约定是使用@<file-path>
请求从文件中获取参数数据,而不是使用参数值本身。
但是,与其他 shell 不同的是,@
是 PowerShell 中的一个 元字符,可用于多种用途。
因此,一个 @
应该是一个 verbatim 字符在一个参数的开头必须 要么是 转义(带 `
)或 引用字符串的一部分 ,如上所示。请参阅概念性 about_Special_Characters 帮助主题。
如果 未转义 参数初始 @
后跟 "
或 '
,PowerShell 认为您正在尝试创建一个here-string,有特殊的多行语法要求;错误消息表明他们不满足。