zoukankan      html  css  js  c++  java
  • ORACLE_LPAD_FUNCTION

    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'
  • 相关阅读:
    P2765 魔术球问题 网络流二十四题重温
    搬东西 dp
    Q
    P2774 方格取数问题 网络流重温
    2019牛客暑期多校训练1
    E. A Simple Task
    Codeforces Round #575 (Div. 3) 昨天的div3 补题
    自动化测试如何准备测试数据
    金三银四,资深HR给面试者的十大建议
    我的自动化测试之路[转载]
  • 原文地址:https://www.cnblogs.com/yjhlsbnf/p/7790069.html
Copyright © 2011-2022 走看看