LTRIM and RTRIM : LTRIM « Char Functions « Oracle PL / SQL






LTRIM and RTRIM

  
SQL>
SQL> CREATE TABLE old_item (
  2       item_id   CHAR(20),
  3       item_desc CHAR(25)
  4       );

Table created.

SQL>
SQL> INSERT INTO old_item VALUES('LA-101', 'Can, Small');

1 row created.

SQL> INSERT INTO old_item VALUES('LA-102', 'Can, Large');

1 row created.

SQL> INSERT INTO old_item VALUES('LA-103', 'Bottle, Small');

1 row created.

SQL> INSERT INTO old_item VALUES('LA-104', 'Bottle, Large');

1 row created.

SQL> INSERT INTO old_item VALUES('NY-101', 'Box, Small');

1 row created.

SQL> INSERT INTO old_item VALUES('NY-102', 'Box, Large');

1 row created.

SQL> INSERT INTO old_item VALUES('NY-103', 'Shipping Carton, Small');

1 row created.

SQL> INSERT INTO old_item VALUES('NY-104', 'Shipping Carton, Large');

1 row created.

SQL>
SQL> SELECT 'Item  ' ||
  2         item_id ||
  3         ' is described as a ' ||
  4         item_desc ||
  5         '.'  "Item Description Sentence"
  6  FROM   old_item;

Item Description Sentence
-----------------------------------------------------------------------
Item  LA-101               is described as a Can, Small               .
Item  LA-102               is described as a Can, Large               .
Item  LA-103               is described as a Bottle, Small            .
Item  LA-104               is described as a Bottle, Large            .
Item  NY-101               is described as a Box, Small               .
Item  NY-102               is described as a Box, Large               .
Item  NY-103               is described as a Shipping Carton, Small   .
Item  NY-104               is described as a Shipping Carton, Large   .

8 rows selected.

SQL>
SQL>
SQL>
SQL> drop table OLD_ITEM;

Table dropped.

SQL>
SQL>

   
  








Related examples in the same category

1.Ltrim: removes a set of characters from the left of a string
2.LTRIM function removes leading characters
3.select '"' || ltrim( ' Some String' ) || '"' "A String"
4.LTRIM('ABCBCA12345', 'ABC')
5.LTRIM('OPS$SPORANO', 'OPS$')
6.Trim letter S from both sides