Customers whose credit limit has not been entered should have the message " Not Available" displayed.
Which SQL statement would produce the required result?
A.SELECT NVL(cust_credit_limit,'Not Available')*.15 "NEW CREDIT" FROM customers;下面看一下示例
SQL> select nvl('abc',123) from dual;
NVL('ABC',123)
--------------
abc
SQL> select nvl(123,'abc') from dual;
select nvl(123,'abc') from dual
ORA-01722: 无效数字
SQL> select nvl(123,'234') from dual;
NVL(123,'234')
--------------
123
SQL> create table customers (cust_credit_limit number);
Table created
SQL> insert into customers values('1');
1 row inserted
SQL> insert into customers values('0.5');
1 row inserted
SQL> insert into customers values(null);
1 row inserted
SQL> commit;
Commit complete
SQL> SELECT NVL(cust_credit_limit,'Not Available') "NEW CREDIT" FROM customers;
SELECT NVL(cust_credit_limit,'Not Available') "NEW CREDIT" FROM customers
ORA-01722: 无效数字
SQL> SELECT NVL(cust_credit_limit,'88999') "NEW CREDIT" FROM customers;
NEW CREDIT
----------
1
0.5
88999
SQL>
但是如果没有数据的话,就会成功
SQL> SELECT NVL(cust_credit_limit,'Not Available') "NEW CREDIT" FROM customers;
NEW CREDIT
----------
SQL>
这道题没有说有没有数据,就按有数据处理吧