SQL:Oracle - 查询中的参数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2086480/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL: Oracle - Parameters in query
提问by Alon Amir
I am trying to use the vs2008
query builder to create a query with a parameter
.
I know that in sql server
it would work with:
我正在尝试使用vs2008
查询构建器创建一个带有parameter
. 我知道sql server
它可以用于:
select col1,col2
from tbl
where col3=@myParam
How would it be typed in oracle or is it pl/sql
?
I get the problem in the @myParam
part.
它将如何在 oracle 中输入或它是pl/sql
?我在@myParam
部分中遇到了问题。
回答by thecoop
Oracle SQL parameters
are specified using :
OracleSQL parameters
被指定使用:
SELECT col1, col2 FROM tbl WHERE col3=:myParam
You will have to be careful when specifying this as an OracleParameter
though, as some libraries miss off the :
, and some require it to bind correctly.
将 this 指定为OracleParameter
虽然时必须小心,因为有些库错过了:
,而有些则要求它正确绑定。