From the course: Oracle Database 12c: Basic SQL
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using RPAD and LPAD - Oracle Database Tutorial
From the course: Oracle Database 12c: Basic SQL
Using RPAD and LPAD
- Using the LPAD and RPAD functions, which are short for left pad and right pad, allows us to buffer strings that will return from the database so that they fill as specified, predetermined lengths. The characters, which fill these strings up to the predetermined required length, can be added to the left part of the string or to the right part of the string. Sounds confusing? Well, it's easier than you think. Let's see it in action. Let's start by selecting the first name column from our employees table. And let's start with an example of the LPAD, or left pad, function. So, we'll specify LPAD, and inside brackets, specify the first underscore name column, followed by the padding length, so 10 characters comma, and, inside quotation marks, the character we want to use for the padding, such as the star character. So running the query as is will return the value for the first name column, but we'll pad it with the star character until the length of the returned valued reaches the number…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Introduction to functions1m 39s
-
(Locked)
Using SUBSTRING, LENGTH, and CONCAT2m 50s
-
(Locked)
Using LENGTH1m 4s
-
(Locked)
Using CONCAT4m 48s
-
(Locked)
Using LOWER and UPPER2m 44s
-
(Locked)
Using INSTR4m 32s
-
(Locked)
Using RPAD and LPAD3m 31s
-
(Locked)
Using TO_CHAR to convert numbers1m 34s
-
(Locked)
Using TO_CHAR to format DATE values2m 59s
-
(Locked)
Using TO_CHAR to filter DATE values1m 57s
-
(Locked)
The special Oracle DUAL table1m 18s
-
(Locked)
Using ROUND1m 15s
-
(Locked)
Using TRUNC1m 36s
-
(Locked)
Using SYSDATE1m 59s
-
(Locked)
Using SYSTIMESTAMP1m 37s
-
(Locked)
Using MONTHS_BETWEEN3m 2s
-
(Locked)
Using ADD_MONTHS1m 17s
-
-
-
-
-
-