PostgreSQL核心自帶的Oracle相容函式
標籤
PostgreSQL , Oracle , 相容函式 , Oracle compatible functions
背景
PostgreSQL功能上基本可以和Oracle對齊,只是一些語法或者函式名不一樣,所以為了做到相容,有一些相容包和相容函式的出現。
PostgreSQL自帶了一些Oracle相容函式,如果你覺得不夠意思,可以通過orafce外掛繼續擴充套件PostgreSQL與Oracle的相容性(本文不涉及orafce包)。
http://api.pgxn.org/src/orafce/orafce-3.3.0/README.asciidoc
PostgreSQL自帶的Oracle相容函式
在原始碼src/backend/utils/adt/oracle_compat.c中可以找到它們的定義
/*-------------------------------------------------------------------------
* oracle_compat.c
* Oracle compatible functions.
*
* Copyright (c) 1996-2016, PostgreSQL Global Development Group
*
* Author: Edmund Mergl <E.Mergl@bawue.de>
* Multibyte enhancement: Tatsuo Ishii <ishii@postgresql.org>
*
*
* IDENTIFICATION
* src/backend/utils/adt/oracle_compat.c
*
*-------------------------------------------------------------------------
*/
/********************************************************************
*
* lower
*
* Syntax:
*
* text lower(text string)
*
* Purpose:
*
* Returns string, with all letters forced to lowercase.
*
********************************************************************/
/********************************************************************
*
* upper
*
* Syntax:
*
* text upper(text string)
*
* Purpose:
*
* Returns string, with all letters forced to uppercase.
*
********************************************************************/
/********************************************************************
*
* initcap
*
* Syntax:
*
* text initcap(text string)
*
* Purpose:
*
* Returns string, with first letter of each word in uppercase, all
* other letters in lowercase. A word is defined as a sequence of
* alphanumeric characters, delimited by non-alphanumeric
* characters.
*
********************************************************************/
/********************************************************************
*
* lpad
*
* Syntax:
*
* text lpad(text string1, int4 len, text string2)
*
* Purpose:
*
* Returns string1, left-padded to length len with the sequence of
* characters in string2. If len is less than the length of string1,
* instead truncate (on the right) to len.
*
********************************************************************/
/********************************************************************
*
* rpad
*
* Syntax:
*
* text rpad(text string1, int4 len, text string2)
*
* Purpose:
*
* Returns string1, right-padded to length len with the sequence of
* characters in string2. If len is less than the length of string1,
* instead truncate (on the right) to len.
*
********************************************************************/
/********************************************************************
*
* btrim
*
* Syntax:
*
* text btrim(text string, text set)
*
* Purpose:
*
* Returns string with characters removed from the front and back
* up to the first character not in set.
*
********************************************************************/
/********************************************************************
*
* btrim1 --- btrim with set fixed as ` `
*
********************************************************************/
/********************************************************************
*
* byteatrim
*
* Syntax:
*
* bytea byteatrim(byta string, bytea set)
*
* Purpose:
*
* Returns string with characters removed from the front and back
* up to the first character not in set.
*
* Cloned from btrim and modified as required.
********************************************************************/
/********************************************************************
*
* ltrim
*
* Syntax:
*
* text ltrim(text string, text set)
*
* Purpose:
*
* Returns string with initial characters removed up to the first
* character not in set.
*
********************************************************************/
/********************************************************************
*
* ltrim1 --- ltrim with set fixed as ` `
*
********************************************************************/
/********************************************************************
*
* rtrim
*
* Syntax:
*
* text rtrim(text string, text set)
*
* Purpose:
*
* Returns string with final characters removed after the last
* character not in set.
*
********************************************************************/
/********************************************************************
*
* rtrim1 --- rtrim with set fixed as ` `
*
********************************************************************/
/********************************************************************
*
* translate
*
* Syntax:
*
* text translate(text string, text from, text to)
*
* Purpose:
*
* Returns string after replacing all occurrences of characters in from
* with the corresponding character in to. If from is longer than to,
* occurrences of the extra characters in from are deleted.
* Improved by Edwin Ramirez <ramirez@doc.mssm.edu>.
*
********************************************************************/
/********************************************************************
*
* ascii
*
* Syntax:
*
* int ascii(text string)
*
* Purpose:
*
* Returns the decimal representation of the first character from
* string.
* If the string is empty we return 0.
* If the database encoding is UTF8, we return the Unicode codepoint.
* If the database encoding is any other multi-byte encoding, we
* return the value of the first byte if it is an ASCII character
* (range 1 .. 127), or raise an error.
* For all other encodings we return the value of the first byte,
* (range 1..255).
*
********************************************************************/
/********************************************************************
*
* chr
*
* Syntax:
*
* text chr(int val)
*
* Purpose:
*
* Returns the character having the binary equivalent to val.
*
* For UTF8 we treat the argumwent as a Unicode code point.
* For other multi-byte encodings we raise an error for arguments
* outside the strict ASCII range (1..127).
*
* It`s important that we don`t ever return a value that is not valid
* in the database encoding, so that this doesn`t become a way for
* invalid data to enter the database.
*
********************************************************************/
/********************************************************************
*
* repeat
*
* Syntax:
*
* text repeat(text string, int val)
*
* Purpose:
*
* Repeat string by val.
*
********************************************************************/
參考
src/backend/utils/adt/oracle_compat.c
http://api.pgxn.org/src/orafce/orafce-3.3.0/README.asciidoc
相關文章
- oracle 系統自帶幾個常用函式Oracle函式
- Python自帶的函式Python函式
- 自帶的 print 函式居然會報錯?函式
- 後來才知道的JavaScript自帶函式JavaScript函式
- Oracle帶引數的自定義函式Oracle函式
- TypeScript 函式相容TypeScript函式
- EDBPPAS(Oracle相容版)Oracle與PostgreSQL相容模式的引數配置切換OracleSQL模式
- EDB PPAS(Oracle 相容版) Oracle與PostgreSQL 相容模式的引數配置切換OracleSQL模式
- PostgreSQL Oracle 相容性 - connect by 2SQLOracle
- STM32呼叫C庫自帶函式函式
- PostgreSQL>視窗函式的用法SQL函式
- PostgreSQL的 SPI_介面函式SQL函式
- PostgreSQL:視窗函式SQL函式
- Python函數語言程式設計自帶函式Python函數程式設計函式
- PostgreSQL函式裡呼叫函式(SETOF + RETURN QUERY)SQL函式
- axios自帶的上傳進度回撥函式iOS函式
- LightDB/PostgreSQL 相容Oracle儲存過程SQLOracle儲存過程
- Oracle vs PostgreSQL Develop(14) - 分析函式KEEP DENSE_RANKOracleSQLdev函式
- PostgreSQL DBA(73) - dump函式SQL函式
- 相容MySQL中的find_in_set函式MySql函式
- 相容所有瀏覽器的getElementsByClassName()函式瀏覽器函式
- 理解 PostgreSQL 的 count 函式的行為SQL函式
- 瀚高DB相容MySQL if函式MySql函式
- C語言中使用系統自帶的快排函式C語言函式
- js函式 函式自呼叫 返回函式的函式 (閉包)JS函式
- 4、核心函式 (轉)函式
- PostgreSQL的generate_series函式應用SQL函式
- 【函式】ORACLE函式大全函式Oracle
- PostgreSQL 查詢替換函式SQL函式
- PostgreSQL:字元——型別及函式SQL字元型別函式
- PostgreSQL 函式獲取表DDLSQL函式
- 使用Oracle自帶profile以及函式簡單設定Oracle使用者名稱密碼規則Oracle函式密碼
- MySQL內建函式:year()、 week()相容MySql函式
- HGDB相容MySQL date_format函式MySqlORM函式
- 二分查詢 - 手寫模板與自帶函式函式
- PostgreSQL核心SQL
- spring呼叫帶引數的oracle函式應注意的問題SpringOracle函式
- 【函式】oracle視窗函式over()的理解函式Oracle