This shows you the differences between two versions of the page.
kurs:null_werte_case [2014/09/10 21:22] |
kurs:null_werte_case [2014/09/10 21:22] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code> | ||
+ | declare | ||
+ | v_bool boolean; | ||
+ | v_out varchar2(10); | ||
+ | begin | ||
+ | v_bool := ('' is null); | ||
+ | -- v_bool := (null = null); | ||
+ | if v_bool = true then | ||
+ | dbms_output.put_line('true'); | ||
+ | elsif v_bool = false then | ||
+ | dbms_output.put_line('false'); | ||
+ | else | ||
+ | dbms_output.put_line('null'); | ||
+ | end if; | ||
+ | |||
+ | v_out := | ||
+ | case v_bool | ||
+ | when true then 'true' | ||
+ | when false then 'false' | ||
+ | when null then 'null' | ||
+ | -- else 'grosses Problem' | ||
+ | end; | ||
+ | |||
+ | dbms_output.put_line(v_out); | ||
+ | |||
+ | end; | ||
+ | </code> |