Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. Declare
  2. v_a_variable varchar2(10);
  3. Begin
  4. v_a_variable := '';
  5.  
  6. --This should succeed but doesn't
  7. If v_a_variable = '' Then
  8. dbms_output.put_line('Is Empty String');
  9. else
  10. dbms_output.put_line('Is Not an Empty String');
  11. end if;
  12.  
  13. --Oracle converts a value being set to '' to null
  14. --but Oracle didn't convert the if = '' to if is null which I think it should have done
  15. If v_a_variable is null Then
  16. dbms_output.put_line('Variable is null');
  17. else
  18. dbms_output.put_line('variable is not null');
  19. end if;
  20. End;
  21.  
  22. if v_a_varable = '' Then
  23.  
  24. if _va_variable is null Then
  25.  
  26. Declare @v_a_variable varchar(10)
  27.  
  28. set @v_a_variable = '';
  29.  
  30. if @v_a_variable = ''
  31. print 'Is Empty String';
  32. else
  33. print 'Is not empty';
  34.  
  35. if @v_a_variable is null
  36. print 'Is null String';
  37. else
  38. print 'Is not null';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement