oracle - ADF SQL 查询在日期周围使用单引号

标签 oracle azure escaping concatenation azure-data-factory

我正在尝试根据日期从 Oracle 中进行简单的提取。最终,我需要该查询是动态的,因此在 ADF 中使用 @concat() 函数。为简单起见,我想使用 concat 在 ADF 中运行以下 Oracle 查询。

由于 oracle 需要单引号,我尝试使用两个单引号来转义它。

Oracle查询:

select * from schema.customer where updated > to_date('06/25/2019','MM/DD/YYYY')

这是我的 ADF 文本:

@concat('select * from iris.iris_customer where updated > to_date(','''06/25/2019''','''MM/DD/YYYY''',');')

我使用 to_date 是因为我收到“不是有效的月份”错误并认为我可以解决它。这是我收到的错误:

{ "errorCode": "2200", "message": "Failure happened on 'Source' side. ErrorCode=UserErrorUnclassifiedError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Odbc Operation Failed.,Source=Microsoft.DataTransfer.ClientLibrary.Odbc.OdbcConnector,''Type=System.Data.Odbc.OdbcException,Message=ERROR [22008] [Microsoft][ODBC Oracle Wire Protocol driver][Oracle]ORA-01843: not a valid month,Source=msora28.dll,'", "failureType": "UserError", "target": "copy_to_adl" }

最佳答案

您应该使用 '' 来转义单引号。

我的示例:@{concat('从 MyTable WHERE [ColumnDate] LIKE 中删除','''',pipeline().parameters.processYear,pipeline().parameters.processMonth,'%',' ''')}

关于oracle - ADF SQL 查询在日期周围使用单引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56782351/

相关文章:

oracle - 如何在 Oracle 中使用另一个 .sql 文件执行 .sql 文件?

sql - 将批处理文件中的参数传递给 sqlplus 脚本

java - glassfish 集群 Web 应用程序部署

java - Oracle DB - 对特定批处理的未初始化集合的 Java 引用

Azure 函数主机自动停止且不重新启动

c# - ASP.NET CORE Web 应用程序抛出 SQLiteException : unable to open database file

python - 尝试在 Azure 上部署 Django 服务器时出现 "ModuleNotFoundError: No module named ' django '"

sass - 在 SASS 中转义 { 和 %

character-encoding - 是否有必要在 XHTML 或 HTML5 中使用——并且——?

java - 在 JAX-RS 中的查询参数中转义 `%` 符号