23. 1. 11. String Operators |
|
PL/SQL has two operators specifically designed to operate only on character string data. |
These are the LIKE operator and the concatenation (||) operator. |
The Syntax for the Concatenation Operator: |
|
string_1 and string_2 are both character strings and can be string constants, string variables, or string expressions. |
SQL>
SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
2 a VARCHAR2(30);
3 b VARCHAR2(30);
4 c VARCHAR2(30);
5 BEGIN
6 c := 'A' || ' AND ' || 'B';
7 DBMS_OUTPUT.PUT_LINE(c);
8 a := ' C ';
9 b := ' D ';
10 DBMS_OUTPUT.PUT_LINE(a || ' ' || b || ',');
11 a := ' E ';
12 b := ' F';
13 c := a || b;
14 DBMS_OUTPUT.PUT_LINE(c);
15 END;
16 /
A AND B
C D ,
E F
PL/SQL procedure successfully completed.
SQL>
|
|