String Operators : Operators « PL SQL Operators « Oracle PL/SQL Tutorial






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 || string_2

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>








23.1.Operators
23.1.1.Operators
23.1.2.The basic arithmetic operators in action
23.1.3.Logical Operators in PL/SQL
23.1.4.Running Anonymous Blocks of Code
23.1.5.Arithmetic Operators
23.1.6.Exponentiation
23.1.7.The negation and identity operators in action.
23.1.8.Comparison Operators
23.1.9.The Relational Operators: =, <>, !=, ~=, <, >, <=, >=
23.1.10.Logical Operators
23.1.11.String Operators
23.1.12.Use of Comparison Operators with Strings