&和有什么区别?和:在Oracle中的PL/SQL中? [英] what is the difference between the & and : in PL/SQL in oracle?
问题描述
我正在学习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 define
d 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屋!