decode [Oracle SQL]

原文: http://www.adp-gmbh.ch/ora/sql/decode.html

参考: http://www.psoug.org/reference/decode_case.html
http://techonthenet.com/oracle/functions/decode.php
decode [Oracle SQL]
		

decode (expression, search_1, result_1)
decode (expression, search_1, result_1, search_2, result_2)
decode (expression, search_1, result_1, search_2, result_2, ...., search_n, result_n)

decode (expression, search_1, result_1, default)
decode (expression, search_1, result_1, search_2, result_2, default)
decode (expression, search_1, result_1, search_2, result_2, ...., search_n, result_n, default)

decode compares expression to the search_x expressions and, if matches, returns result_x. If not, returns default, or, if default is left out, null.
This is demonstrated with the following example:

create table a (x int, b int);

insert into a values (1,2);
insert into a values (1,3);
insert into a values (2,4);
insert into a values (2,5);
insert into a values (3,6);

select * from a where b = decode (x,1,2,2,4);

         X          B
---------- ----------
         1          2
         2          4




----------------------------------------------------------------------

你可能感兴趣的:(html,oracle,sql,PHP)