数据库CLOB为空的判断方法是什么
短信预约 -IT技能 免费直播动态提醒
这篇文章主要介绍“数据库CLOB为空的判断方法是什么”,在日常操作中,相信很多人在数据库CLOB为空的判断方法是什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”数据库CLOB为空的判断方法是什么”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
下列的哪些选项在执行之后会显示 "CLOB has a length of 0" ?
(A)
DECLARE
l_clob CLOB;
BEGIN
IF l_clob IS NULL
THEN
DBMS_OUTPUT.put_line ('CLOB is NULL');
ELSE
DBMS_OUTPUT.put_line ('CLOB has a length of '
|| LENGTH (l_clob));
END IF;
END;
/
SQL> DECLARE
2 l_clob CLOB;
3 BEGIN
4 IF l_clob IS NULL
5 THEN
6 DBMS_OUTPUT.put_line ('CLOB is NULL');
7 ELSE
8 DBMS_OUTPUT.put_line ('CLOB has a length of '
9 || LENGTH (l_clob));
10 END IF;
11 END;
12 /
CLOB is NULL
PL/SQL procedure successfully completed
SQL>
(B)
DECLARE
l_clob CLOB := EMPTY_CLOB ();
BEGIN
IF l_clob IS NULL
THEN
DBMS_OUTPUT.put_line ('CLOB is NULL');
ELSE
DBMS_OUTPUT.put_line ('CLOB has a length of '
|| LENGTH (l_clob));
END IF;
END;
/
SQL> DECLARE
2 l_clob CLOB := EMPTY_CLOB ();
3 BEGIN
4 IF l_clob IS NULL
5 THEN
6 DBMS_OUTPUT.put_line ('CLOB is NULL');
7 ELSE
8 DBMS_OUTPUT.put_line ('CLOB has a length of '
9 || LENGTH (l_clob));
10 END IF;
11 END;
12 /
CLOB has a length of 0
PL/SQL procedure successfully completed
SQL>
(C)
DECLARE
l_clob CLOB := '';
BEGIN
IF l_clob IS NULL
THEN
DBMS_OUTPUT.put_line ('CLOB is NULL');
ELSE
DBMS_OUTPUT.put_line ('CLOB has a length of '
|| LENGTH (l_clob));
END IF;
END;
/
SQL> DECLARE
2 l_clob CLOB := '';
3 BEGIN
4 IF l_clob IS NULL
5 THEN
6 DBMS_OUTPUT.put_line ('CLOB is NULL');
7 ELSE
8 DBMS_OUTPUT.put_line ('CLOB has a length of '
9 || LENGTH (l_clob));
10 END IF;
11 END;
12 /
CLOB is NULL
PL/SQL procedure successfully completed
SQL>
(D)
DECLARE
l_clob1 CLOB := EMPTY_CLOB ();
l_clob2 CLOB := l_clob1;
BEGIN
IF l_clob2 IS NULL
THEN
DBMS_OUTPUT.put_line ('CLOB is NULL');
ELSE
DBMS_OUTPUT.put_line ('CLOB has a length of '
|| LENGTH (l_clob2));
END IF;
END;
/
SQL> DECLARE
2 l_clob1 CLOB := EMPTY_CLOB ();
3 l_clob2 CLOB := l_clob1;
4 BEGIN
5 IF l_clob2 IS NULL
6 THEN
7 DBMS_OUTPUT.put_line ('CLOB is NULL');
8 ELSE
9 DBMS_OUTPUT.put_line ('CLOB has a length of '
10 || LENGTH (l_clob2));
11 END IF;
12 END;
13 /
CLOB has a length of 0
PL/SQL procedure successfully completed
答案BD. 注意答案C里面的 '' 相当于NULL.
到此,关于“数据库CLOB为空的判断方法是什么”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341