Augment info on string functions per Jose Soares' suggestions.
This commit is contained in:
parent
bda6246664
commit
f3fde99841
@ -65,54 +65,86 @@ available through operators and may be documented as operators only.
|
||||
</Para>
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<title>String Functions</title>
|
||||
<sect1>
|
||||
<title>String Functions</title>
|
||||
|
||||
<Para>
|
||||
SQL92 defines string functions with specific syntax. Some of these
|
||||
are implemented using other <ProductName>Postgres</ProductName> functions.
|
||||
</Para>
|
||||
<Para>
|
||||
SQL92 defines string functions with specific syntax. Some of these
|
||||
are implemented using other <ProductName>Postgres</ProductName> functions.
|
||||
The supported string types for <acronym>SQL92</acronym> are
|
||||
<type>char</type>, <type>varchar</type>, and <type>text</type>.
|
||||
</Para>
|
||||
|
||||
<Para>
|
||||
<TABLE TOCENTRY="1">
|
||||
<TITLE><Acronym>SQL92</Acronym> String Functions</TITLE>
|
||||
<TGROUP COLS="4">
|
||||
<THEAD>
|
||||
<ROW>
|
||||
<ENTRY>Function</ENTRY>
|
||||
<ENTRY>Returns</ENTRY>
|
||||
<ENTRY>Description</ENTRY>
|
||||
<ENTRY>Example</ENTRY>
|
||||
</ROW>
|
||||
</THEAD>
|
||||
<TBODY>
|
||||
<ROW>
|
||||
<ENTRY> position(text in text) </ENTRY>
|
||||
<ENTRY> int4 </ENTRY>
|
||||
<ENTRY> location of specified substring </ENTRY>
|
||||
<ENTRY> position('o' in 'Tom') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> substring(text [from int] [for int]) </ENTRY>
|
||||
<ENTRY> text </ENTRY>
|
||||
<ENTRY> extract specified substring </ENTRY>
|
||||
<ENTRY> substring('Tom' from 2 for 2) </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> trim([leading|trailing|both] [text] from text) </ENTRY>
|
||||
<ENTRY> text </ENTRY>
|
||||
<ENTRY> trim characters from text </ENTRY>
|
||||
<ENTRY> trim(both 'x' from 'xTomx') </ENTRY>
|
||||
</ROW>
|
||||
</TBODY>
|
||||
</TGROUP>
|
||||
</TABLE>
|
||||
</Para>
|
||||
<Para>
|
||||
<TABLE TOCENTRY="1">
|
||||
<TITLE><Acronym>SQL92</Acronym> String Functions</TITLE>
|
||||
<TGROUP COLS="4">
|
||||
<THEAD>
|
||||
<ROW>
|
||||
<ENTRY>Function</ENTRY>
|
||||
<ENTRY>Returns</ENTRY>
|
||||
<ENTRY>Description</ENTRY>
|
||||
<ENTRY>Example</ENTRY>
|
||||
</ROW>
|
||||
</THEAD>
|
||||
<TBODY>
|
||||
<ROW>
|
||||
<ENTRY> char_length(string) </ENTRY>
|
||||
<ENTRY> int4 </ENTRY>
|
||||
<ENTRY> length of string </ENTRY>
|
||||
<ENTRY> char_length('jose') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> character_length(string) </ENTRY>
|
||||
<ENTRY> int4 </ENTRY>
|
||||
<ENTRY> length of string </ENTRY>
|
||||
<ENTRY> char_length('jose') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> lower(string) </ENTRY>
|
||||
<ENTRY> string </ENTRY>
|
||||
<ENTRY> convert string to lower case </ENTRY>
|
||||
<ENTRY> lower('TOM') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> octet_length(string) </ENTRY>
|
||||
<ENTRY> int4 </ENTRY>
|
||||
<ENTRY> storage length of string </ENTRY>
|
||||
<ENTRY> octet_length('jose') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> position(string in string) </ENTRY>
|
||||
<ENTRY> int4 </ENTRY>
|
||||
<ENTRY> location of specified substring </ENTRY>
|
||||
<ENTRY> position('o' in 'Tom') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> substring(string [from int] [for int]) </ENTRY>
|
||||
<ENTRY> string </ENTRY>
|
||||
<ENTRY> extract specified substring </ENTRY>
|
||||
<ENTRY> substring('Tom' from 2 for 2) </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> trim([leading|trailing|both] [string] from string) </ENTRY>
|
||||
<ENTRY> string </ENTRY>
|
||||
<ENTRY> trim characters from string </ENTRY>
|
||||
<ENTRY> trim(both 'x' from 'xTomx') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> upper(text) </ENTRY>
|
||||
<ENTRY> text </ENTRY>
|
||||
<ENTRY> convert text to upper case </ENTRY>
|
||||
<ENTRY> upper('tom') </ENTRY>
|
||||
</ROW>
|
||||
</TBODY>
|
||||
</TGROUP>
|
||||
</TABLE>
|
||||
</Para>
|
||||
|
||||
<Para>
|
||||
Many string functions are available for text, varchar(), and char() types.
|
||||
Some are used internally to implement the SQL92 string functions listed above.
|
||||
</Para>
|
||||
<Para>
|
||||
Many additional string functions are available for text, varchar(), and char() types.
|
||||
Some are used internally to implement the SQL92 string functions listed above.
|
||||
</Para>
|
||||
|
||||
<Para>
|
||||
<TABLE TOCENTRY="1">
|
||||
@ -146,12 +178,6 @@ Some are used internally to implement the SQL92 string functions listed above.
|
||||
<ENTRY> initcap('thomas') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> lower(text) </ENTRY>
|
||||
<ENTRY> text </ENTRY>
|
||||
<ENTRY> convert text to lower case </ENTRY>
|
||||
<ENTRY> lower('TOM') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> lpad(text,int,text) </ENTRY>
|
||||
<ENTRY> text </ENTRY>
|
||||
<ENTRY> left pad string to specified length </ENTRY>
|
||||
@ -164,9 +190,9 @@ Some are used internally to implement the SQL92 string functions listed above.
|
||||
<ENTRY> ltrim('xxxxtrim','x') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> position(text,text) </ENTRY>
|
||||
<ENTRY> textpos(text,text) </ENTRY>
|
||||
<ENTRY> text </ENTRY>
|
||||
<ENTRY> extract specified substring </ENTRY>
|
||||
<ENTRY> locate specified substring </ENTRY>
|
||||
<ENTRY> position('high','ig') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
@ -217,12 +243,6 @@ Some are used internally to implement the SQL92 string functions listed above.
|
||||
<ENTRY> convert text to varchar type </ENTRY>
|
||||
<ENTRY> varchar('text string') </ENTRY>
|
||||
</ROW>
|
||||
<ROW>
|
||||
<ENTRY> upper(text) </ENTRY>
|
||||
<ENTRY> text </ENTRY>
|
||||
<ENTRY> convert text to upper case </ENTRY>
|
||||
<ENTRY> upper('tom') </ENTRY>
|
||||
</ROW>
|
||||
</TBODY>
|
||||
</TGROUP>
|
||||
</TABLE>
|
||||
@ -689,3 +709,19 @@ support functions.
|
||||
|
||||
</chapter>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"./reference.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog"
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
-->
|
||||
|
Loading…
x
Reference in New Issue
Block a user