7

This is impossible to search on google, bing, yahoo, etc, because it uses symbols. How annoying!

What's the difference between ::= and := in oracle's pl/sql?

moodymudskipper
  • 46,417
  • 11
  • 121
  • 167
dansch
  • 6,059
  • 4
  • 43
  • 59
  • 2
    Do you have an actual Oracle code sample which uses `::=`? If so, please post it. – APC Aug 26 '14 at 20:13
  • 3
    There is no `::=` standard operator in Oracle SQL or in PL/SQL. I suppose that someone might have defined `::=` as a user-defined operator (see [CREATE OPERATOR](http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_6004.htm#i2064967)) but having never done it I'm not sure how this would work. [SQL operator reference here](http://docs.oracle.com/cd/B28359_01/server.111/b28286/operators.htm#SQLRF003). [PL/SQL operator reference here](http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/index.htm#OP). Please edit your question and include a code sample. Share and enjoy. – Bob Jarvis - Слава Україні Aug 26 '14 at 23:52
  • 1
    Meaning of `:=` is easily (?) found from Oracle documentation [PL/SQL Language Fundamentals](http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/fundamentals.htm#CIHJCJAD). You can also observe that PL/SQL doesn't have such a built-in delimiter as `::=`. I agree with comments of @APC and @BobJarvis. – user272735 Aug 27 '14 at 03:43

2 Answers2

7

I am not sure about ::= as I have not seen that in Oracle but the wiki says about :=

In computer programming languages, the equals sign typically denotes either a boolean operator to test equality of values (e.g. as in Pascal or Eiffel), which is consistent with the symbol's usage in mathematics, or an assignment operator (e.g. as in C-like languages). Languages making the former choice often use a colon-equals (:=) or ≔ to denote their assignment operator. Languages making the latter choice often use a double equals sign (==) to denote their boolean equality operator.

Also check here:

The assignment operator in PL/SQL is a colon plus an equal sign (:=). PL/SQL string literals are delimited by single quotes

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
3

The only place (that I'm aware of) where ::= is used is in the syntactical description of PL/SQL (or any other language, for that matter) using Backus-Naur Form (BNF). The ::= symbol is a part of the BNF descriptive language itself, not a part of the language being described. There are many tutorials for BNF -- have fun!

TommCatt
  • 5,498
  • 1
  • 13
  • 20
  • cf. http://stackoverflow.com/questions/9196066/what-does-a-double-colon-followed-by-an-equals-sign-mean-in-programming-do – kmote Oct 12 '15 at 15:08
  • Almost all Oracle SQL tutorials are [using BNF](http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5010.htm). Thank you ! – another Jan 10 '17 at 16:29