• Oracle/PLSQL: TRIM Function-from cyber


    Oracle/PLSQL: TRIM Function

    This Oracle tutorial explains how to use the Oracle/PLSQL TRIM function with syntax and examples.

    Description

    The Oracle/PLSQL TRIM function removes all specified characters either from the beginning or the ending of a string.

    Syntax

    The syntax for the TRIM function in Oracle/PLSQL is:

    TRIM( [ [ LEADING | TRAILING | BOTH ] trim_character FROM ] string1 )

    Parameters or Arguments

    LEADING
    The function will remove trim_character from the front of string1.
    TRAILING
    The function will remove trim_character from the end of string1.
    BOTH
    The function will remove trim_character from the front and end of string1.
    trim_character
    The character that will be removed from string1. If this parameter is omitted, the TRIM function will remove space characters from string1.
    string1
    The string to trim.

    Note:

    • If you do not choose a value for the first parameter (LEADING, TRAILING, BOTH), the TRIM function will remove trim_character from both the front and end of string1.
    • See also the LTRIM and RTRIM functions.

    Applies To

    The TRIM 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 TRIM function examples and explore how to use the TRIM function in Oracle/PLSQL.

    For example:

    TRIM('   tech   ')
    Result: 'tech'
    
    TRIM(' '  FROM  '   tech   ')
    Result: 'tech'
    
    TRIM(LEADING '0' FROM '000123')
    Result: '123'
    
    TRIM(TRAILING '1' FROM 'Tech1')
    Result: 'Tech'
    
    TRIM(BOTH '1' FROM '123Tech111')
    Result: '23Tech'
  • 相关阅读:
    逆向挑战赛Bob Doge 和 who is he
    [ACTF新生赛2020]rome
    [ACTF新生赛2020]usualCrypt
    MAZE
    $FFT/NTT/FWT$题单&简要题解
    普通型生成函数总结
    [BZOJ4817][SDOI2017]树点涂色:Link-Cut Tree+线段树
    [BZOJ3527][ZJOI2014]力:FFT
    长链剖分优化树形DP总结
    Dsu on Tree总结
  • 原文地址:https://www.cnblogs.com/Jeffrey-xu/p/4819574.html
Copyright © 2020-2023  润新知