oracle 在oracle中绑定变量?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4458230/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 22:12:43  来源:igfitidea点击:

bind variables in oracle?

oraclevariablesbind

提问by maephisto

I'm starting to work with Oracle DB, and I'm demanded to use bind variables in my app. Can someone give some brief directions what's bind variables advantage and when should i use them ?

我开始使用 Oracle DB,我需要在我的应用程序中使用绑定变量。有人可以简要说明绑定变量的优势是什么,我应该什么时候使用它们?

Thanks!

谢谢!

采纳答案by sjngm

The big advantage of using bind variables is that you can write a full statement that Oracle can pre-compile already. In other words it doesn't need to re-parse the statement again just because you're looking for value 1 instead of 100. A bind variable more or less is a place-holder.

使用绑定变量的一大优点是您可以编写 Oracle 已经可以预编译的完整语句。换句话说,它不需要再次重新解析语句,因为您正在寻找值 1 而不是 100。绑定变量或多或少是一个占位符。

回答by Jagmag

This is a very good articlethat consolidates a lot of information about Bind Variables in Oracle.

这是一篇很好的文章,整合了大量关于Oracle中绑定变量的信息。

The link to the explanation by Tom Kyte referenced at the end of this article is broken but it can be found at Ask Tom : How To Use Bind Variableslink instead

本文末尾引用的 Tom Kyte 解释的链接已损坏,但可以在Ask Tom : How To Use Bind Variables链接中 找到它

In case you are using .NET with Oracle, a code example of how to use Bind Variables can be found here

如果您将 .NET 与 Oracle 一起使用,可以在此处找到有关如何使用绑定变量的代码示例

回答by winkbrace

Bind variables are also great against sql injection! :)

绑定变量也非常适合 sql 注入!:)

回答by Umesh Vishwakarma

The app built using bind variable in Oracle DB improves overall performance of query because it's value doesn't occupy storage in Oracle database

在 Oracle DB 中使用绑定变量构建的应用程序提高了查询的整体性能,因为它的值不占用 Oracle 数据库中的存储