Oracle / PLSQL: LPAD Function

This Oracle tutorial explains how to use the Oracle/PLSQL LPAD function with syntax and examples.

Description

The Oracle/PLSQL LPAD function pads the left-side of a string with a specific set of characters (when string1 is not null).

Syntax

The syntax for the LPAD function in Oracle/PLSQL is:

LPAD( string1, padded_length [, pad_string] )

Parameters or Arguments

string1
The string to pad characters to (the left-hand side).
padded_length
The number of characters to return. If the padded_length is smaller than the original string, the LPAD function will truncate the string to the size of padded_length.
pad_string
Optional. This is the string that will be padded to the left-hand side of string1. If this parameter is omitted, the LPAD function will pad spaces to the left-side of string1.

Returns

The LPAD function returns a string value.

Applies To

The LPAD function can be used in the following versions of Oracle/PLSQL:

  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

Example

Let's look at some Oracle LPAD function examples and explore how to use the LPAD function in Oracle/PLSQL.

For example:

 table can use dual example.such as select lpad('tech',7) from dual;

LPAD('tech', 7);
Result: '   tech' LPAD('tech', 2);
Result: 'te' LPAD('tech', 8, '0');
Result: '0000tech' LPAD('tech on the net', 15, 'z');
Result: 'tech on the net' LPAD('tech on the net', 16, 'z');
Result: 'ztech on the net'

ORACLE_LPAD_FUNCTION的更多相关文章

随机推荐

  1. 【DP】+【贪心】【前缀和】洛谷P2893 [USACO08FEB]修路Making the Grade 题解

        正常的没想到的DP和玄学贪心. 题目描述 A straight dirt road connects two fields on FJ's farm, but it changes eleva ...

  2. 离散化test

    #include<bits/stdc++.h> using namespace std; const int maxn = 1e6+11; int ll[maxn],rr[maxn],ma ...

  3. Scala构建工具sbt的配置

    时间是17年12月24日.初学Scala,想使用它的标配构建工具sbt,结果好大一轮折腾,因为公司隔离外网,需要内部代理,所以尤其折腾.下面的配置参考了好多篇不同的文章,已经没法一一留下出处了.而且还 ...

  4. [转] 理解SVG transform坐标变换

    http://www.zhangxinxu.com/wordpress/2015/10/understand-svg-transform/

  5. C++ GUI Qt4编程(10)-3.4spreadsheet

    1. C++ GUI Qt4编程第三章,增加spreadsheet. 2. spreadsheet.h /**/ #ifndef SPREADSHEET_H #define SPREADSHEET_H ...

  6. [转]创建节约内存的JavaBean

    转自:创建节约内存的JavaBean 如果编写节约内存的java对象 编写Java代码的时候,大多数情况下,我们很少关注一个Java对象究竟有多大(占据多少内存),更多的是关注业务与逻辑.但是殊不知, ...

  7. isqlplus的使用

    1 再安装Oracle的机器上开启服务[命令services.msc] 2 浏览器输入下面的网址: 虚拟机[安装orcale的机器]:http://localhost:5560/isqlplus/ 本 ...

  8. hibernate框架配置文件详解

    1 orm元数据配置文件(映射文件) <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hib ...

  9. MySql Unknown column 的解决方案

    解决方案: 有很多使用Mysql的用户可能都会遇到这个问题,明明表中这个列存在,为什么在查询的时候说找不到这个列名呢? 我遇到的原因就是列名前面含有空格:如下 create table student ...

  10. 【Linux】快速清空当前文件

    $ : > filename $ > filename $ echo "" > filename $ echo > filename $ cat /dev/ ...