Oracle PL/SQL/PL SQL/subtype

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

Create a constrained subtype DB_STRING

    
SQL>
SQL> DECLARE
  2    SUBTYPE db_string IS VARCHAR2(4000 BYTE);
  3    c VARCHAR2(1 CHAR) := "A";
  4    d DB_STRING;
  5  BEGIN
  6    d := c;
  7  END;
  8  /
PL/SQL procedure successfully completed.
SQL>
SQL>



Creates and uses a constrained subtype CODE

    
SQL>
SQL> DECLARE
  2    SUBTYPE code IS CHAR(1 CHAR);
  3    c CHAR(1 CHAR) := "A";
  4    d CODE;
  5  BEGIN
  6    d := c;
  7  END;
  8  /
PL/SQL procedure successfully completed.
SQL>