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. 使用JDBC连接了数据库的图书管理系统2.0

    更新日志: 2019.3.28 数据库版本2.0 1.使用mySQL数据库 2.修改代码使用JDBC连接数据库 3.新增Manage操作类及DBUtils数据库工具类 4.完善代码(封装及方法调用) ...

  2. ecmall模板编辑中的标题如何自定义读取

    碰见了一个问题,刚上线的ecmall项目.客户说标题不要商城首页这四个字. 我去源码里找,找了半天才找到. 问题描述如下: 找到title的最原始模板themes\mall\tmall\top.htm ...

  3. ASP.Net Core 发布ABP项目遇到的错误

    1.HTTP 错误 500.19 - Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效. 与ASP.NET时代不同,ASP.NET Core不再是由IIS工作 ...

  4. layer弹出层显示在top顶层

    父页面 导入 layer.js 或者 layui.all.js,导入后就能正常显示在父窗口页面区域. 1.显示在顶层窗口 top.layer.open({ type: 2, area: ['98%', ...

  5. Tomcat服务器安装

    Tomcat服务器类似于XAMPP,主要安装步骤如下. 第一步: 安装JDK. 第二步: 安装tomcat. 第三步: 启动tomcat下bin下的startup.bat即可启动tomcat. 可能出 ...

  6. spark on yarn模式里需要有时手工释放linux内存

    为什么要提出这个问题? spark跑YARN模式或Client模式提交任务不成功(application state: ACCEPTED) 然后执行 [spark@master spark--bin- ...

  7. yum安装git

    此方法对于RHEL.Fedora.CentOS有效: 1.yum install git 2.yum istall git-svn git-email git-gui gitk

  8. URAL 1252 ——Sorting the Tombstones——————【gcd的应用】

    Sorting the Tombstones Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I ...

  9. 【Shell】shell的运算

    一.除法 a=12 b=7 1) expr $a / $b  计算出结果为个1 ,只支持整除 2) echo "scale=2;$a/$b" | bc结果为 1.71 3) awk ...

  10. 4、加载:Loading

    /* ---html----*/ <ion-content> <button (click)="manual()">手动关闭</button> ...