Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 Anonymous Block

Similar presentations


Presentation on theme: "Chapter 2 Anonymous Block"— Presentation transcript:

1 Chapter 2 Anonymous Block
Dasar Pemrograman Basis Data MI2163

2 Block Types unnamed blocks are not stored in the database

3 Create An Anonymous Block
Type the anonymous block in SQLPlus environment: SQL> BEGIN 2 DBMS_OUTPUT.PUT_LINE('Hello World'); 3 END; 4 / Hello World PL/SQL procedure successfully completed.

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28 Creating A PL/SQL Records

29

30

31

32 The %ROWTYPE Attribute

33 Inserting a Record Using %ROWTYPE

34 Updating a Row in a Table Using a Record

35

36

37

38

39

40

41

42 Example of Bind Variables in SQLPlus Environment
SQL> VARIABLE v_word1 VARCHAR2(5); SQL> VARIABLE v_word2 VARCHAR2(5); SQL> BEGIN 2 :v_word1:='Hello'; 3 :v_word2:='World'; 4 DBMS_OUTPUT.PUT_LINE(:v_word1||' '||:v_word2); 5 END; 6 / Hello World PL/SQL procedure successfully completed.

43

44

45 Example of Substitution Variables in SQLPlus Environment
SQL> -- input nilai menggunakan variabel substitusi SQL> DECLARE 2 v_word1 VARCHAR2(5):= '&input1'; 3 v_word2 VARCHAR2(5):= '&input2'; 4 BEGIN 5 DBMS_OUTPUT.PUT_LINE(v_word1||' '||v_word2); 6 END; 7 / Enter value for input1: Hello Enter value for input2: World Hello World PL/SQL procedure successfully completed.


Download ppt "Chapter 2 Anonymous Block"

Similar presentations


Ads by Google