By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,601 Members | 989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,601 IT Pros & Developers. It's quick & easy.

Nullif syntax in a query .......pls help

P: 5
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tablename
  2. SELECT    a.*,
  3.     ((CASE WHEN Nullif(Trim(a.f1),'NULL') is null or trim(a.f1) = '' THEN 'f1 IS NULL;' ELSE '' END)|| 
  4.      (CASE WHEN Nullif(Trim(a.f2),'NULL') is null or trim(a.f2) = '' THEN 'f2 IS NULL;' ELSE '' END)||
  5.      (CASE WHEN Nullif(Trim(a.f3),'NULL') is null or trim(a.f3) = '' THEN 'f3 IS NULL;' ELSE '' END    ) AS EXCEPTION_MESSAGE        
  6. FROM     table2 a
  7. WHERE    Nullif(Trim(a.f1),'NULL') IS NULL
  8.    OR trim(a.f1) = ''
  9.    Nullif(Trim(a.f2),'NULL') IS NULL
  10.    OR trim(a.f2) = ''
  11.    Nullif(Trim(a.f3),'NULL') IS NULL
  12.    OR trim(a.f3) = '' 
  13.  
  14. /*;*/
Oct 1 '15 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,359
Please use code tags when posting code or formatted data.

You have no logical operators in your WHERE clause between your sets of conditions.
Oct 1 '15 #2

P: 5
Thanks ,....OR was missing in my where clause, thanks for the answer
Oct 2 '15 #3

Post your reply

Sign in to post your reply or Sign up for a free account.