oracle中的procedure中trim,upper函数和decode函数有什么不同?

如题所述

第1个回答  2015-06-17
trim去空格,
upper 变为大写字符
decode 用法 decode(value, if1, then1, if2,then2, if3,then3, . . . else )
你写的decode当然不行,看用法追问

decode(p_enable_flag, 1, 'Y', 'N')这样吗?
你给个范例吧

追答

例如,decode(p_enable_flag, 1, 'Y',2, 'N',3,'Q') 意思是如果p_enable_flag这个字段为1的话,p_enable_flag的值就是Y,如果为2 值就为N,如果为3 值就为Q。就像if语句,用法就是上边给你说的,decode(value, if1, then1, if2,then2, if3,then3, . . . else ),你也可以百度oracle decode,详细看一下

追问

decode(p_enable_flag, 1, 'Y', 'N')那么这个为什么是通过的呢,不过是查询,插入,更新语句?pl/sql骗人?

追答

decode 还有个用法:
DECODE(字段或字段的运算,值1,值2,值3)
这个函数运行的结果是,当字段或字段的运算的值等于值1时,该函数返回值2,否则返回值3
网上有详细解释。

相似回答