Oracle PL/SQL/PL SQL/Concatenation Operator

Материал из SQL эксперт
Перейти к: навигация, поиск

||: the concatenation operator

SQL>
SQL> -- Use of the concatenation operator.
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2     a     VARCHAR2(30);
  3     b     VARCHAR2(30);
  4     c     VARCHAR2(30);
  5  BEGIN
  6     -- Concatenate several string constants.
  7     c := "A" || " AND " || "B";
  8     DBMS_OUTPUT.PUT_LINE(c);
  9     -- Concatenate both string variables and constants.
 10     a := "A";
 11     b := "B";
 12     DBMS_OUTPUT.PUT_LINE(a || " " || b || ",");
 13     -- Concatenate two string variables.
 14     a := "A ";
 15     b := "B";
 16     c := a || b;
 17     DBMS_OUTPUT.PUT_LINE(c);
 18  END;
 19  /
A AND B
A B,
A B
PL/SQL procedure successfully completed.
SQL>