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. Pollard_Rho 整数分解法【学习笔记】

    引文:如果要对比较大的整数分解,显然之前所学的筛选法和是试除法都将不再适用.所以我们需要学习速度更快的Pollard_Rho算法. 算法原理: 生成两个整数a和b,计算p=gcd(a-b, n),知道 ...

  2. 高僧斗法(nim博弈)----------蓝桥备战系列

    标题:高僧斗法 古时丧葬活动中经常请高僧做法事.仪式结束后,有时会有"高僧斗法"的趣味节目,以舒缓压抑的气氛. 节目大略步骤为:先用粮食(一般是稻米)在地上"画" ...

  3. Collectors.groupingBy分组后的排序问题

    默认groupingBy代码里会生成一个HashMap(hashMap是无序的,put的顺序与get的顺序不一致) HashMap是无序的,HashMap在put的时候是根据key的hashcode进 ...

  4. springboot(三)-使用JSP

    Springboot的默认视图支持是Thymeleaf.这里先不谈,这么优秀的框架怎么可能不能使用JSP呢?不允许的. 那么需要添加对jsp的支持. pom.xml 在pom.xml文件中添加依赖 & ...

  5. 给新人看的 JavaScript的继承

    //这个继承方式是给新人看的,逻辑简单一些 Object.extend=function(props){ //继承父类 var prototype=Object.create(this.prototy ...

  6. java.lang.ref.Reference<T>

    //看之前先要知道java里面的四种引用.package com.zby.ref; import sun.misc.Cleaner; /** * 引用对象的抽象基础类.这个类定义了所有引用对象的公共操 ...

  7. Java基础22-Static关键字

    1.static关键字 public class Test{ public static void main(String[] args){ Persion p1=new Persion(); Per ...

  8. AutoFac之 Named and Keyed 方式注入

    AutoFac是.net framework下一个高效的ioc容器,传说中的效率最快(我偷偷看了几篇测试博文,确实这个容器的效率遥遥领先). 好了废话不多说,AutoFac的使用方式请看:http:/ ...

  9. 使用bind配置DNS服务(CentOS 6.5)

    DNS域名解析服务(Domain Name System)是用于解析域名与IP地址对应关系的服务,功能上可以实现正向解析与反向解析: 正向解析:根据主机名(域名)查找对应的IP地址. 反向解析:根据I ...

  10. 常用css搜集

    div居中显示 position: fixed; top: 130px; left:0px;right:0px;margin-left:auto;margin-right:auto;