SQL/PLUS Study NotesOfSQL BufferThis is what we will introduce in this article. Next we will introduce it one by one, hoping to get some benefits for you!
SQL Buffer
(1). Store only one SQL command;
(2) The save command outputs the SQL command in the current SQL Buffer to a file with a specified file name on the disk;
Eg: SQL> save c:/hr press enter and then generate the hr. SQL file on drive c.
(3). list command: displays the SQL command in the current SQL Buffer;
(4 ). run and/(slash-diagonal line) run SQL commands in SQL Buffer. The former displays the SQL commands to be executed and then the running results, while the latter directly displays the running results;
(5). To display the print result on the sqlplus terminal, you must set the parameter serveroutput.
- SQL> show serveroutput
- serveroutput OFF
As you can see, serveroutput is disabled. Use the following command to set the status to open:
- SQL> set serveroutput on
- SQL> show serveroutput
- serveroutput ON SIZE UNLIMITED FORMAT WORD_WRAPPED
Eg:
- SQL> declare
- x varchar2(15) :='Hello World !';
- begin
- dbms_output.put_line(x);
- exception
- when others then
- dbms_output.put_line('Error!');
- end;
- SQL> list
- declare
- x varchar2(15) :='Hello World !';
- begin
- dbms_output.put_line(x);
- exception
- when others then
- dbms_output.put_line('Error!');
- * end;
The usage of SQL Buffer in SQL/PLUS learning notes will be introduced here. I hope this introduction will be helpful to you!