gpt4 book ai didi

sql - Oracle 中的查询错误

转载 作者:行者123 更新时间:2023-12-04 18:25:26 28 4
gpt4 key购买 nike

我正在使用 Oracle 并在我的 toad 中使用它来检查结果是什么。但是我收到错误信息

ORA-01740: missing double quote in identifier

这是我的问题

SELECT T1.Project_Id, 
PROPERTY_NAME Project_name,
T1.Vehicle_No,
T1.Creation_date,
T1.Time_In,
T1.Time_Out
FROM
XXCUS.XX_SUPINV T1
INNER JOIN XXACL_PN_PROJBUILD_V T2
ON T1.Project_Id = T2.Project_id
WHERE t1.Project_Id = '" + ddlProjectName.SelectedValue + "'
AND Creation_date BETWEEN to_date fnd_conc_date.string_to_date('"TxtIndate.Text"') AND
to_date fnd_conc_date.string_to_date('"txtOutDate.Text"')"

请指出我错在哪里

最佳答案

这是您尝试执行的实际查询(带有数据)。

SELECT T1.Project_Id, 
PROPERTY_NAME Project_name,
T1.Vehicle_No,
T1.Creation_date,
T1.Time_In,
T1.Time_Out
FROM
XXCUS.XX_SUPINV T1
INNER JOIN XXACL_PN_PROJBUILD_V T2
ON T1.Project_Id = T2.Project_id
WHERE t1.Project_Id = '409'
AND Creation_date BETWEEN to_date('01-jan-2015','DD-mon-yyyy') AND
to_date('01-jan-2012','DD-mon-yyyy')

您的程序化版本可能是(只是从您的基础版本派生而来)

 sl =  "SELECT T1.Project_Id, 
PROPERTY_NAME Project_name,
T1.Vehicle_No,
T1.Creation_date,
T1.Time_In,
T1.Time_Out
FROM
XXCUS.XX_SUPINV T1
INNER JOIN XXACL_PN_PROJBUILD_V T2
ON T1.Project_Id = T2.Project_id
WHERE t1.Project_Id = '" + ddlProjectName.SelectedValue + "'
AND Creation_date BETWEEN fnd_conc_date.string_to_date('" + TxtIndate.Text+ "') AND
fnd_conc_date.string_to_date('"+ txtOutDate.Text +"')"

To improve readability and avoid SQL*Injection,you should try using bind variables( I am not so thorough with the .NET syntax)

关于sql - Oracle 中的查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31218137/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com