I get the error message “ORA-00939: too many arguments for the function”.The answer is:Yes, the maximum number of components that you can have in a DECODE function is 255. This includes, search and result arguments.SQL tutorial: DECODE function in Oracle DatabaseAbout Enteros...
Oracle Function: Case and Decode CASE expression perform if-then-else logic in SQL without having to use PL/SQL. CASE works in a similar manner to DECODE(). CASE is ANSI-compliant. There are two types of CASE expressions: Simple case expressions use expressions to determine the returned valu...
The DECODE function is without doubt one of the most powerful in Oracle's SQL. It is one of several extensions Oracle added to the standard SQL language. DECODE can be used for the generation of crosstab reports. You can also use the CASE function and the COALESCE function to execute ...
If the first result has the data type CHAR or if the first result is null, then Oracle converts the return value to the data type VARCHAR2. In a DECODE function, Oracle considers two nulls to be equivalent. If expr is null, then Oracle returns the result of the first search that ...
∙Oracle 9i, Oracle 10g, Oracle 11g 例如:You could use the decode function in an SQL statement as follows:select supplier_name,decode(supplier_id,1000,'IBM',10001,'Microsoft','1002','Hewlett Packard','Gateway') result from suppliers;上面的sql语句相当于下面的IF-THEN-ELSE :IF supplier_...
oracle中to_char(), to_date() ,ROUND(),NVL(), DECODE(), EXTRACT()等函数的使用 1.to_char() 将时间日期按照指定的格式输出,得到的是字符串,而非date类型。 只要被转换的是一个日期,yyyy,mm,dd中间加不加连接符,加什么连接符都可以 2.to date()...
说明1:NVL和NVL2函数在进行空值判断的时候,都会将函数内的表达式执行一次。 4、DECODE函数: 是oracle数据库独家提供的函数功能,不是sql标准, 相当于程序语言中的 if 1=1 then 1 else 1!=1的执行效果; DECODE(value, if1, then1, if2,then2, if3,then3, . . . else ) ...
createorreplacefunctiondecode(variadic p_decode_listtext[])returnstextas$$declare-- 获取数组长度(即入参个数)v_leninteger:=array_length(p_decode_list,1);-- 声明存放返回值的变量v_rettext;begin/* * 功能说明:模拟Oracle中的DECODE功能(字符串处理, 其它格式可以自行转换返回值) ...
※引述自http://www.techonthenet.com/oracle/functions/decode.php In Oracle/PLSQL, thedecodefunction has the functionality of an IF-THEN-ELSE statement. The syntax for thedecodefunction is: decode( expression , search , result [, search , result]… [, default] ) ...
说明1:NVL和NVL2函数在进行空值判断的时候,都会将函数内的表达式执行一次。 4、DECODE函数: 是oracle数据库独家提供的函数功能,不是sql标准, 相当于程序语言中的 if 1=1 then 1 else 1!=1的执行效果; DECODE(value, if1, then1, if2,then2, if3,then3, . . . else ) ...