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. Vue-cli 构建项目 的`.vue`组件中, scss中添加背景图路径问题

    [解决方法]: 更改build/utils.js文件中的 ExtractTextPlugin 的 options配置. if (options.extract) { return ExtractTex ...

  3. shopNC开发手册

    链接:   https://wenku.baidu.com/view/b9232d24dd3383c4bb4cd2c9.html https://wenku.baidu.com/view/ff1566 ...

  4. 【Python】struts2-045批量检测

    0x00   环境 存在struts2-045漏洞的war包 apache-tomcat 0x01   脚本 #coding:utf-8 import re import urllib import ...

  5. PIE SDK地图鼠标事件监听

    1.功能简介 地图鼠标事件包含鼠标的按下MouseDown(),弹起MouseUp(),移动MouseMove()等事件,通过这些事件可以对地图进行动态的操作,接下来以地图状态栏的信息为例具体介绍如何 ...

  6. PIE SDK神经网络聚类

    1.算法功能简介 神经网络是模仿人脑神经系统的组成方式与思维过程而构成的信息处理系统,具有非线性.自学性.容错性.联想记忆和可以训练性等特点.在神经网络中,知识和信息的传递是由神经元的相互连接来实现的 ...

  7. How to fix the issue that GEM_HOME and/or GEM_PATH not set issue for rvm in mac version 10.12

    add following lines below "export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for s ...

  8. (转)详解Linux中SSH远程访问控制

    详解Linux中SSH远程访问控制 原文:http://blog.51cto.com/dengqi/1260038 SSH:是一种安全通道协议,主要用来实现字符界面的远程登录,远程复制等功能(使用TC ...

  9. php高手干货【必看】

    1.用单引号代替双引号来包含字符串,这样做会更快一些.因为PHP会在双引号包围的字符串中搜寻变量, 单引号则不会,注意:只有echo能这么做,它是一种可以把多个字符串当作参数的"函数&quo ...

  10. Become a Better Programmer: 5 Essential Methods at a Glance--reference

    http://www.git-tower.com/blog/become-a-better-programmer-5-essentials/ Become a Better Programmer: 5 ...