Database (Update)

Query Plan

explain plan  for select * from test;
select * from table(dbms_xplan.display());

View index table

SELECT

       b.uniqueness, a.index_name, a.table_name, a.column_name

FROM all_ind_columns a, all_indexes b

WHERE a.index_name=b.index_name

  AND a.table_name = upper('表名')

ORDER BY a.table_name, a.index_name, a.column_position;

decode function

decode (condition value 1, returns the value 1, value 2, returns the value 2, ... value n, the return value of n, the default value)
the IF condition value = 1THEN
the RETURN (Return 1)
ELSIF condition value = 2THEN
the RETURN (Return value 2)
...

#oracle 链接字符串用 ||
select name||decode(name,null,'&','*') from test;

Without a specific practical example, why give this example because, if ... else believe can understand, however, many people might be interpreted as "if the name is null, add &, * if the name is, behind not things, not read "...
the true meaning:
the query name, if the name is null, add & behind, if not null, * plus
equivalent

if(name == null) return "&";
else return name + "*";

Then come back another example

select name||decode(name,a,'&','b','*') from test;

Equivalent to

if("a".equals(name))  return name + "&";
else if("b".equals(name)) return name + "*";
Released seven original articles · won praise 0 · Views 108

Guess you like

Origin blog.csdn.net/weixin_44188300/article/details/103762784