http://www.itpub.net/thread-1499223-12-1.html
113楼
下面的选项都实现了这个过程:
CREATE OR REPLACE PROCEDURE plch_show_lowest ( number1_in IN NUMBER , number2_in IN NUMBER , number3_in IN NUMBER) IS
哪一种能够显示传入的三个数中最小的一个?假设传给plch_show_lowest的实际值都不为空。
(A)
BEGIN DBMS_OUTPUT.put_line ( LEAST (number1_in, LEAST (number2_in, number3_in))); END;
(B)
BEGIN DBMS_OUTPUT.put_line ( SMALLEST (number1_in, number2_in, number3_in)); END;
(C)
BEGIN DBMS_OUTPUT.put_line ( MIN (number1_in, number2_in, number3_in)); END;
(D)
l_lowest NUMBER; BEGIN SELECT LEAST (number1_in, number2_in, number3_in) INTO l_lowest FROM DUAL; DBMS_OUTPUT.put_line (l_lowest); END;
(E)
l_lowest NUMBER := number1_in; BEGIN IF number2_in < l_lowest THEN l_lowest := number2_in; END IF; IF number3_in < l_lowest THEN l_lowest := number3_in; END IF; DBMS_OUTPUT.put_line (l_lowest); END;
(F)
BEGIN DBMS_OUTPUT.put_line ( LEAST (number1_in, number2_in, number3_in)); END;
实测
B报错 PLS-00201: 必须声明标识符 'SMALLEST'
C报错 PLS-00103: 出现符号 ")"在需要下列之一时: := . ( % ; 符号 "(" 被替换为 ")" 后继续。
ADEF均正确
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。