ITPub博客

首页 > Linux操作系统 > Linux操作系统 > instr和decode

instr和decode

原创 Linux操作系统 作者:31597359 时间:2019-06-30 08:30:07 0 删除 编辑

instr和decode


In Oracle/PLSQL, the instr function returns the location of a substring in a string.

The syntax for the instr function is:

instr (string1, string2, [start_position], [nth_appearance])

string1 is the string to search.

string2 is the substring to search for in string1.

start_position is the position in string1 where the search will start. This argument is optional. If omitted, it defaults to 1. The first position in the string is 1. If the start_position is negative, the function counts back start_position number of characters from the end of string1 and then searches towards the beginning of string1.

nth_appearance is the nth appearance of string2. This is optional. If omiited, it defaults to 1.

再说明一下decode()的功能和语法:

In Oracle/PLSQL, the decode function has the functionality of an IF-THEN-ELSE statement.

The syntax for the decode function is:

decode ( expression , search , result [, search , result]... [, default] )

expression is the value to compare.

search is the value that is compared against expression.

result is the value returned, if expression is equal to search.

default is optional. If no matches are found, the decode will return default. If default is omitted, then the decode statement will return null (if no matches are found).

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8000572/viewspace-62186/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2006-10-07

  • 博文量
    112
  • 访问量
    67792