&和有什么区别?和:在Oracle中的PL/SQL中? [英] what is the difference between the & and : in PL/SQL in oracle?

查看:88
本文介绍了&和有什么区别?和:在Oracle中的PL/SQL中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习PL/SQL&我正在通过绑定变量. 我知道我们用来传递RUN-TIME值的绑定变量.

I am stuying PL/SQL & I am going through the bind variable . I understood that the bind variable we used to pass RUN-TIME values.

但是&和之间有什么区别?和:(冒号)在PL/SQL中?两者相同还是两者之间有何不同?我什么时候应该使用&和:?

but what is the difference between & and :(colon) in PL/SQL? both are same or is their any difference between this two? when should I use & and : ?

推荐答案

&仅在SQL*Plus中使用,它之外没有任何意义.

The & is used in SQL*Plus only, it has no meaning outside of it.

SQL*Plus解析"输入缓冲区时,它会将&variables替换为define的内容.另请参见此链接此链接. 技术术语替代变量.

While SQL*Plus "parses" the input buffer, it replaces &variables with what they were defined to. See also this link and this link. The technical term is substitution variable.

另一方面,:variable real 绑定变量.当Oracle的SQL引擎解析"并执行SQL语句时,将使用它们.例如,请参见此链接此链接.

On the other hand :variable are real bind variables. They are used when Oracle's SQL engine "parses" and executes the SQL statement. See for example this link or this link.

因此,简而言之,&variables被传递给Oracle SQL引擎的SQL * Plus和 then 所代替,而:variables被SQL Plus保持不变并传递给Oracle的SQL引擎出现.在SQL Plus之外,&没有任何意义.

So, in short, &variables are replaced by SQL*Plus and then passed to Oracle's SQL engine, while :variables are left untouched by SQLPlus and passed to Oracle's SQL engine as they appear. Outside fo SQLPlus, & makes no sense.

这篇关于&和有什么区别?和:在Oracle中的PL/SQL中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆