PostgreSQL存储过程中字符串参数两边强制追加(单引号)

更新时间:2023-05-25 22:32:17 阅读: 评论:0

lofacePostgreSQL存储过程中字符串参数两边强制追加(单引号)使⽤函数quote_literal即可。
其他字符串操作函数有:
函数:string || string 说明:String concatenation 字符串连接操作例⼦:'Post' || 'greSQL' = PostgreSQL
函数:string || non-string or non-string || string说明:String concatenation with one non-string input 字符串与⾮字符串类型进⾏连接操作例⼦:'Value: ' || 42 = Value: 42
函数:bit_length(string)说明:Number of bits in string 计算字符串的位数例⼦:bit_length('jo') = 32
函数:char_length(string) or character_length(string)说明:Number of characters in string 计算字符串中字符个数例⼦:char_length('jo') = 4
函数:lower(string)说明:Convert string to lower ca 转换字符串为⼩写例⼦:bit_length('jo') = 32
函数:octet_length(string)说明:Number of bytes in string 计算字符串的字节数例⼦:octet_length('jo') = 4
函数:overlay(string placing string from int [for int])说明:Replace substring 替换字符串中任意长度的⼦字串为新字符串例⼦:overlay('Txxxxas' placing
'hom' from 2 for 4) = 4
函数:position(substring in string)说明:Location of specified substring ⼦串在⼀字符串中的位置例⼦:position('om' in 'Thomas') = 3
函数:substring(string [from int] [for int])说明:Extract substring 截取任意长度的⼦字符串例⼦:substring('Thomas' from 2 for 3) = hom
函数:substring(string from pattern)说明:Extract substring matching POSIX regular expression. See Section 9.7 for more information on pattern matching. 利⽤正则表达式对⼀字符串进⾏任意长度的字串的截取例⼦:substring('Thomas' from '...$') = mas
函数:substring(string from pattern for escape)说明:Extract substring matching SQL regular expression. See Section 9.7 for more information on pattern matching. 利于正则表达式对某类字符进⾏删除,以得到⼦字符串例⼦:trim(both 'x' from 'xTomxx') = Tom
函数:trim([leading | trailing | both] [characters] from string) 说明:Remove the longest string contain
ing only the characters (a space by default) from the start/end/both ends of the string 去除尽可能长开始,结束或者两边的某类字符,默认为去除空⽩字符,当然可以⾃⼰指定,可同时指定多个要删除的字符串例⼦:trim(both 'x' from 'xTomxx') = Tom
accompany过去式函数:upper(string)说明:Convert string to upperca 将字符串转换为⼤写例⼦:upper('tom') = TOM
函数:ascii(string)说明:ASCII code of the first character of the argument. For UTF8 returns the Unicode code point of the character. For other multibyte encodings. the argument must be a strictly ASCII character. 得到某⼀个字符的Assii值例⼦:ascii('x') = 120
函数:btrim(string text [, characters text])说明:Remove the longest string consisting only of characters in characters (a space by default) from the start and end of string 去除字符串两边的所有指定的字符,可同时指定多个字符例⼦:btrim('xyxtrimyyx', 'xy') = trim
函数:chr(int)说明:Character with the given code. For UTF8 the argument is treated as a Unicode code point. For other multibyte encodings the argument must designate a strictly ASCII character. The NULL (0) character is not allowed becau text data types cannot store such bytes. 得到某ACSII值对应的字符例⼦:chr(65) = A
函数:convert(string bytea, src_encoding name, dest_encoding name) 说明:Convert string to dest_encoding. The original encoding is specified by src_encoding. The string must be valid in this encoding. Conversions can be defined by CREATE CONVERSION. Also there are some predefined conversions. See Table 9-7 for available conversions. 转换字符串编码,指定源编码与⽬标编码例⼦:convert('text_in_utf8', 'UTF8', 'LATIN1') =
badminton是什么意思
slashtext_in_utf8 reprented in ISO 8859-1 encoding
数字用英语怎么念text_in_utf8 reprented in ISO 8859-1 encoding
函数:convert_from(string bytea, src_encoding name) 说明:Convert string to the databa encoding. The original encoding is specified by
src_encoding. The string must be valid in this encoding. 转换字符串编码,⾃⼰要指定源编码,⽬标编码默认为数据库指定编码,例⼦:
convert_from('text_in_utf8', 'UTF8') = text_in_utf8 reprented in the current databa encoding
函数:convert_to(string text, dest_encoding name) 说明:Convert string to dest_encoding.转换字符串编码,源编码默认为数据库指定编码,⾃⼰要指定⽬标编码,例⼦:convert_to('some text', 'UTF8')
= some text reprented in the UTF8 encoding
函数:decode(string text, type text) 说明:Decode binary data from string previously encoded with encode. Parameter type is same as in encode. 对字符串按指定的类型进⾏解码例⼦:decode('MTIzAAE=', 'ba64') = 123/000/001
函数:encode(data bytea, type text) 说明:Encode binary data to different reprentation. Supported types are: ba64, hex, escape. Escape merely outputs null bytes as /000 and doubles backslashes. 与decode相反,对字符串按指定类型进⾏编码例⼦:encode(E'123//000//001', 'ba64') = MTIzAAE=
函数:initcap(string)说明:Convert the first letter of each word to upperca and the rest to lowerca. Words are quences of alphanumeric characters parated by non-alphanumeric characters. 将字符串所有的单词进⾏格式化,⾸字母⼤写,其它为⼩写例⼦:initcap('hi THOMAS') = Hi Thomas
函数:length(string)说明:Number of characters in string 讲算字符串长度例⼦:length('jo') = 4
函数:length(stringbytea, encoding name )说明:Number of characters in string in the given encodin
g. The string must be valid in this encoding. 计算字符串长度,指定字符串使⽤的编码例⼦:length('jo', 'UTF8') = 4
函数:lpad(string text, length int [, fill text]) 说明:Fill up the string to length length by prepending the characters fill (a space by default). If the string is already longer than length then it is truncated (on the right). 对字符串左边进⾏某类字符⾃动填充,即不⾜某⼀长度,则在左边⾃动补上指定的字符串,直⾄达到指定长度,可同时指定多个⾃动填充的字符例⼦:lpad('hi', 5, 'xy') = xyxhi
函数:ltrim(string text [, characters text]) 说明:Remove the longest string containing only characters from characters (a space by default) from the start of string 删除字符串左边某⼀些的字符,可以时指定多个要删除的字符例⼦:trim
函数:md5(string)说明:Calculates the MD5 hash of string, returning the result in hexadecimal 将字符串进⾏md5编码例⼦:md5('abc') =
900150983cd24fb0 d6963f7d28e17f72
函数:pg_client_encoding()说明:Current client encoding name 得到pg客户端编码例⼦:pg_client_encoding() = SQL_ASCII
函数:quote_ident(string text)说明:Return the given string suitably quoted to be ud as an identifier in an SQL statement string. Quotes are added only if necessary (i.e., if the string contains non-identifier characters or would be ca-folded). Embedded quotes are properly doubled. 对某⼀字符串加上两引号例⼦:quote_ident('Foo bar') = "Foo bar"
函数:quote_literal(string text)说明:Return the given string suitably quoted to be ud as a string literal in an SQL statement string. Embedded
single-quotes and backslashes are properly doubled. 对字符串⾥两边加上单引号,如果字符串⾥⾯出现sql编码的单个单引号,则会被表达成两个单引号例⼦:quote_literal('O/'Reilly') = 'O''Reilly'
函数:quote_literal(value anyelement)说明:Coerce the given value to text and then quote it as a literal. Embedded single-quotes and backslashes
are properly doubled. 将⼀数值转换为字符串,并为其两边加上单引号,如果数值中间出现了单引号,也会被表⽰成两个单引号例⼦:quote_literal(42.5) = '42.5'
函数:regexp_matches(string text, pattern text [, flags text])说明:Return all captured substrings resulting from matching a POSIX regular
aled lead acid batteryexpression against the string. See Section 9.7.3 for more information. 对字符串按正则表达式进⾏匹配,如果存在则会在结果数组中表⽰出来例⼦:revenant
regexp_matches('foobarbequebaz', '(bar)(beque)') = {bar,beque}
函数:regexp_replace(string text, pattern text, replacement text [, flags text])说明:Replace substring(s) matching a POSIX regular expression. See Section 9.7.3 for more information. 利⽤正则表达式对字符串进⾏替换例⼦:regexp_replace('Thomas', '.[mN]a.', 'M') = ThM
函数:regexp_split_to_array(string text, pattern text [, flags text ])说明:Split string using a POSIX regular expression as the delimiter. See Section 9.7.3 for more information. 利⽤正则表达式将字符串分割成数组例⼦:regexp_split_to_array('hello world', E'//s+') = {hello,world}
9.7.3 for more information. 利⽤正则表达式将字符串分割成数组例⼦:regexp_split_to_array('hello world', E'//s+') = {hello,world}
函数:regexp_split_to_table(string text, pattern text [, flags text])说明:Split string using a POSIX regular expression as the delimiter. See Section
9.7.3 for more information. 利⽤正则表达式将字符串分割成表格例⼦:regexp_split_to_table('hello w
orld', E'//s+') = helloworld(2 rows)
函数:repeat(string text, number int)说明:Repeat string the specified number of times 重复字符串⼀指定次数例⼦:repeat('Pg', 4) = PgPgPgPg
函数:replace(string text, from text, to text)说明:Replace all occurrences in string of substring from with substring to 将字符的某⼀⼦串替换成另⼀⼦串例⼦:('abcdefabcdef', 'cd', 'XX') = abXXefabXXef
函数:rpad(string text, length int [, fill text]) 说明:Fill up the string to length length by appending the characters fill (a space by default). If the string is already longer than length then it is truncated. 对字符串进⾏填充,填充内容为指定的字符串例⼦:rpad('hi', 5, 'xy') = hixyx
函数:rtrim(string text [, characters text])说明:Remove the longest string containing only characters from characters (a space by default) from the end of string 去除字符串右边指定的字符例⼦:rtrim('trimxxxx', 'x') = trim
函数:split_part(string text, delimiter text, field int)说明:Split string on delimiter and return the given field (counting from one) 对字符串按指定⼦串进⾏分割,并返回指定的数值位置的值例⼦:split_part('abc~@~def~@~ghi', '~@~', 2) = def
cerberus
函数:strpos(string, substring)说明:Location of specified substring (same as position(substring in string), but note the reverd argument order) 指定字符串在⽬标字符串的位置例⼦:strpos('high', 'ig') = 2
函数:substr(string, from [, count])说明:Extract substring (same as substring(string from from for count)) 截取⼦串例⼦:substr('alphabet', 3, 2) = ph
函数:to_ascii(string text [, encoding text])说明:Convert string to ASCII from another encoding (only supports conversion from LATIN1, LATIN2, LATIN9, and WIN1250 encodings) 将字符串转换成ascii编码字符串例⼦:to_ascii('Karel') = Karel
periodical函数:to_hex(number int or bigint)说明:Convert number to its equivalent hexadecimal reprentation  对数值进⾏⼗六进制编码例⼦:
to_hex(2147483647) = 7fffffff
函数:translate(string text, from text, to text) 说明:Any character in string that matches a character in the from t is replaced by the corresponding character in the to t 将字符串中某些匹配的字符替换成指定字符串,⽬标字符与源字符都可以同时指定多个例⼦:translate('12345', '14', 'ax') = a23x5
weight什么意思

本文发布于:2023-05-25 22:32:17,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/122624.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:字符串   指定   编码   字符   长度   单引号   转换
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图