Avaast me hearties & scurvy dogs alike,
(aka morning all!)
This is an interesting thread. I’m sticking my nose in and adding my own £0.02.
In SQL*PLus there are two buffers, one for SQL statements (INSERT, DELETE etc) and one for PL/SQL.
When you type DECLARE or BEGIN or CREATE OR REPLACE {PROCEDURE|FUNCTION|PACKAGE [BODY]} etc, you enter the PL/SQL mode and use the PL/SQL buffer for all your typing. This is how you are able to enter a semicolon followed by ENTER and not have that statement executed - which is what happens in the SQL buffer.
To exit from the PL/SQL buffer, you enter a slash as the first character on the line, followed by any number of spaces that you like, followed by ENTER.
Alternatively, to exit and throw away the buffer contents, type a full stop as the first character - trailing characters are ignored.
When you hit ENTER after that slash in column 1, Oracle sends the PL/SQL buffer’s contents top the PL/SQL engine to be parsed and hopefully, executed.
The use of two buffers is a good idea as far as I’m concerned. Another database I use (Firebird/Interbase) has a single buffer. In order to type in Firebird’s equivalent of PL/SQL, I have to change the terminator character:
SET TERM “^”;
…
SELECT stuff
FROM table
INTO variable
WHERE condition;
…
^
When the interpreter sees the final ‘^’ character, it know that I’m done typing and executes the contents of the buffer.
Cheers,
Norm. [TeamT]
Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else. We have checked this email and its attachments for viruses. But you should still check any attachment before opening it. We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes. If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk
Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.
We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.
If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk