我正在尝试根据日期从 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/