Change book title to upper case if it is not : UPPER « Character String Functions « Oracle PL/SQL Tutorial






SQL>
SQL> CREATE TABLE employee_evaluation (
  2  id              number,
  3  title           varchar2(100),
  4  written_date    date );

Table created.

SQL>
SQL>
SQL>
SQL> INSERT INTO employee_evaluation(id,title,written_date)VALUES(100,'SQL',to_date('19700101', 'YYYYMMDD') );

1 row created.

SQL> INSERT INTO employee_evaluation(id,title,written_date)VALUES(100,'Java',to_date('19900101', 'YYYYMMDD') );

1 row created.

SQL> INSERT INTO employee_evaluation(id,title,written_date)VALUES(200,'C++',to_date('20030101', 'YYYYMMDD') );

1 row created.

SQL> INSERT INTO employee_evaluation(id,title,written_date)VALUES(200,'C',to_date('20000101', 'YYYYMMDD') );

1 row created.

SQL> INSERT INTO employee_evaluation(id,title,written_date)VALUES(200,'Oracle',to_date('20020101', 'YYYYMMDD') );

1 row created.

SQL> INSERT INTO employee_evaluation(id,title,written_date)VALUES(200,'Theory',to_date('20050101', 'YYYYMMDD') );

1 row created.

SQL> INSERT INTO employee_evaluation(id,title,written_date)values(300,'Third',to_date('20000101', 'YYYYMMDD')
  2  INSERT INTO employee_evaluation(id,title,written_date)values(300,'Data',to_date('20020101', 'YYYYMMDD')
  3
SQL> select * from employee_evaluation;

    ID TITLE                                                                                             WRITTEN_DATE
------ ---------------------------------------------------------------------------------------------------- ----------------
   100 SQL                                                                                                19700101 000000
   100 Java                                                                                               19900101 000000
   200 C++                                                                                                20030101 000000
   200 C                                                                                                  20000101 000000
   200 Oracle                                                                                             20020101 000000
   200 Theory                                                                                             20050101 000000

6 rows selected.

SQL>
SQL>
SQL> UPDATE employee_evaluation
  2  SET    title = upper(title)
  3  where  title <> upper(title);

3 rows updated.

SQL>
SQL> select * from employee_evaluation;

    ID TITLE                                                                                             WRITTEN_DATE
------ ---------------------------------------------------------------------------------------------------- ----------------
   100 SQL                                                                                                19700101 000000
   100 JAVA                                                                                               19900101 000000
   200 C++                                                                                                20030101 000000
   200 C                                                                                                  20000101 000000
   200 ORACLE                                                                                             20020101 000000
   200 THEORY                                                                                             20050101 000000

6 rows selected.

SQL>
SQL> drop table employee_evaluation;

Table dropped.

SQL>








11.10.UPPER
11.10.1.UPPER(x) converts the letters in x to uppercase.
11.10.2.Use upper() function in where clause
11.10.3.Change column data to upper case
11.10.4.Change book title to upper case if it is not
11.10.5.Combine upper function with LIKE