那位雄的知道那有sql在oracel中的语法的资料,再问个问题nvl在oracel中是啥意思?(100分)

  • 主题发起人 墙头草
  • 开始时间

墙头草

Unregistered / Unconfirmed
GUEST, unregistred user!
那位雄的知道那有sql在oracel中的语法的资料,再问个问题nvl在oracel中是啥意思?
 
nvl = no value
就是如果字段的值为null时设置为某一值
 
to dz2050
可以说说nvl的语法结构吗
 
http://www.db.cs.ucdavis.edu/teaching/sqltutorial/
http://www.experts-exchange.com/Databases/Oracle/Q_10290394.html
 
上otn.oracle.com去找就行了, 所有文档都在线 [:)]
NVL是一内置函数,文档里有详细说明。
举例来说: select NVL(A, 'asdf') from table
返回的结果就是:
if A is null then
Result := 'asdf';
else
Result := A;
end if;

详细说明:
NVL ( expr1 , expr2 )
Purpose
If expr1 is null, NVL returns expr2. If expr1 is not null, NVL returns expr1.
The arguments expr1 and expr2 can have any datatype. If their datatypes are
different, Oracle converts expr2 to the datatype of expr1 before comparing them.

The datatype of the return value is always the same as the datatype of expr1,
unless expr1 is character data, in which case the return value's datatype is
VARCHAR2 and is in the character set of expr1.

Example
The following example returns a list of employee names and commissions,
substituting "Not Applicable" if the employee receives no commission:

SELECT last_name, NVL(TO_CHAR(commission_pct), 'Not Applicable')
"COMMISSION" FROM employees
WHERE last_name LIKE 'B%';

LAST_NAME COMMISSION
------------------------- ----------------------------------------
Baer Not Applicable
Baida Not Applicable
Banda .11
Bates .16
Bell Not Applicable
Bernstein .26
Bissot Not Applicable
Bloom .21
Bull Not Applicable

 
多谢兄弟们,送分了[:D]
 
顶部