469628006 by Unknown

469628006 by Unknown

Author:Unknown
Language: eng
Format: epub


Figure 5.2

Let’s demonstrate another function:

SELECT description, Upper(description) FROM film;

Run this query; the output will have the description column and the uppercase of that column.

We can even use it with strings as follows:

Figure 5.3

The Character Manipulation Functions

The character manipulation functions can be used to manipulate character strings. There are many such functions, and we will have demonstrations of them one by one in this section. We can use strings or character columns with these functions.

We can concatenate two strings with the function It works in the same way as the operator Both the arguments to the call of this function are stings. Following are the examples of the same:

SELECT CONCAT('Oracle', ' SQL') FROM DUAL;

SELECT CONCAT(title, description) FROM film;

In the first example, we are concatenating two strings, and in the second example, we are concatenating two different character columns. This is one of the simplest character manipulation functions.

We can extract a substring from a string with the function as follows:

SELECT SUBSTR('Oracle SQL', 1, 6) FROM DUAL;

The indexing of the strings starts from 1. The first argument is the string or the column from which we need to extract the substring. The second and third arguments are starting and ending indices of the substring from the string. The query above will output the string

We can use the function to determine the length of a string or a character column as follows:

SELECT title, LENGTH(title) FROM film;

We can know the location of a substring within a string using the function as follows:

SELECT INSTR('Oracle SQL', 'S') FROM DUAL;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.