PL SQL Introduction- Blocks&example.pptx

sivamathi12 6 views 23 slides Aug 21, 2024
Slide 1
Slide 1 of 23
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23

About This Presentation

.


Slide Content

PL/SQL

https://www.slideshare.net/slideshow/class-01-23894673/23894673#8

The PL/SQL Comments The PL/SQL supports single-line and multi-line comments. All characters available inside any comment are ignored by the PL/SQL compiler. The PL/SQL single-line comments start with the delimiter -- ( double hyphen) Multi-line comments are enclosed by /* and */. DECLARE -- variable declaration message varchar2(20):= 'Hello, World!'; BEGIN /* * PL/SQL executable statement(s) */ dbms_output.put_line (message); END;

We noted earlier that PL/SQL is not a stand-alone programming language; rather, it exists only as a tool within the Oracle environment. As a result, it does not really have any capabilities to accept input from a user. The lack of this ability is compensated with the special feature of the SQL Developer and SQL*Plus tools called a substitution variable. Similarly , it is often helpful to provide the user with some pertinent information with the help of the DBMS_OUTPUT.PUT_LINE statement.

DBMS_OUTPUT.PUT_LINE statement may be used in a script to display information on the screen. The DBMS_OUTPUT.PUT_LINE is a call to the procedure PUT_LINE . This procedure is a part of the DBMS_OUTPUT package that is owned by the Oracle user SYS. The DBMS_OUTPUT.PUT_LINE statement writes information to the buffer for storage. After a program has completed, the information from the buffer is displayed on the screen. The size of the buffer can be set between 2000 and 1 million bytes. To see the results of the DBMS_OUTPUT.PUT_LINE statement on the screen, you need to enable it.

https://www.pearsonitcertification.com/articles/article.aspx?p=3178919&seqNum=3#:~:text=Oracle%20user%20SYS.-,The%20DBMS_OUTPUT.,2000%20and%201%20million%20bytes .

To enable the DBMS_OUTPUT statement in SQL*Plus, you enter one of the following statements before the PL/SQL block: SET SERVEROUTPUT ON; or SET SERVEROUTPUT ON SIZE 5000; The first SET statement enables the DBMS_OUTPUT.PUT_LINE statement, with the default value for the buffer size being used. The second SET statement not only enables the DBMS_OUTPUT.PUT_LINE statement but also changes the buffer size from its default value to 5000 bytes. Similarly, if you do not want information to be displayed on the screen by the DBMS_OUTPUT.PUT_LINE statement, you can issue the following SET command prior to the PL/SQL block: SET SERVEROUTPUT OFF;
Tags