I reviewing some PL/SQL code and I came across the following in the scripts:
/
SHOW error
grant execute on someName1 to someName2;
/
SHOW error
Reviewing the documentation for PL/SQL I could not find an explanation what the /'s do.
Can anyone enlighten me?
That is the keyword/value notation for passing parameters to a PL/SQL procedure or function. The left side is the name of the parameter, the right is the value being passed. It's useful when you don't want to keep to a specific ordering of parameters, or for self-documenting code.
:= is the assignment operator in PL/SQL (Oracle's procedural extension to SQL). You use this to assign values to variables. If you just use = then this is checking for equality rather than assigning a value.
The Oracle IN condition is used to help reduce the need to use multiple OR conditions in a SELECT, INSERT, UPDATE, or DELETE statement.
"/" executes the sql command in the current buffer. It similar to GO of SQL Server
The slash basically executes the latest command stored in the buffer.
It's kind of a clunky thing, but a lot of PL/SQL interpreters/engines like SQL Plus require you to enter a "/" after every complete statement to actually execute it and see the results.
http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12004.htm#SQPUG162
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With