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. bzoj3196 二逼平衡树 树状数组套线段树

    题目传送门 思路:树状数组套线段树模板题. 什么是树状数组套线段树,普通的树状数组每个点都是一个权值,而这里的树状数组每个点都是一颗权值线段树,我们用前缀差分的方法求得每个区间的各种信息, 其实关键就 ...

  2. express运行www后,在http://localhost:3000/查看返回会报 Cannot find module 'jade'

    解决方法:npm install --save express jade

  3. 合唱团---DP

    https://www.nowcoder.com/practice/661c49118ca241909add3a11c96408c8?tpId=85&tqId=29830&tPage= ...

  4. poj1862

    一.题意:两个物体m1.m2相撞后会变成一个物体,这个物体的重量会变成2*sqrt(m1*m2).有n个物体,假设只会发生两两相撞,求最后剩下的最小重量. 二.思路:简单的贪心.越大的数开越多的次方, ...

  5. 文献综述六:基于JS 技术的电子商品管理系统设计及实现

    一.基本信息 标题:基于JS 技术的电子商品管理系统设计及实现 时间:2017 出版源:无线互联科技 文件分类:js技术的研究 二.研究背景 主要对Js下电商管理系统的设计及实现进行了探讨,利用软件工 ...

  6. D. Match & Catch 后缀自动机 || 广义后缀自动机

    http://codeforces.com/contest/427/problem/D 题目是找出两个串的最短公共子串,并且在两个串中出现的次数只能是1次. 正解好像是dp啥的,但是用sam可以方便很 ...

  7. 安装Newton版Glance

    Image Service 本文介绍在controller节点上安装.配置Image服务 glance,镜像存储在本地文件系统 安装准备 controller 节点 ip:192.168.81.11 ...

  8. (转)模块readline解析

    模块readline解析 原文:https://www.cnblogs.com/fireflow/p/4841413.html readline模块定义了一系列函数用来读写Python解释器中历史命令 ...

  9. 在ZYNQ-7000平台上利用PS点亮PL上的LED灯

    在ZYNQ-7000平台上利用PS点亮PL上的LED灯 1.实验方案 图1    实验方案系统框图 2.具体步骤 2.1.vivado工程建立 ①打开vivado集成开发环境,点击“Create Pr ...

  10. Linux分区扩容

    lz在MAC上面使用Linux虚拟机,开始只建了一个分区,挂载在”/”目录下.现在硬盘空间不够了,所以lz就来给这个分区扩容. 首先,当然是要给虚拟机分配更多的硬盘空间喽(lz用的是VMware Fu ...