0

I'm working on a project, in which I'm creating a SQLite database table and it has certain number of columns. I want to include a condition that if a particular column is not null, then perform certain action (in order to fill that value up). I searched a lot, but didn't find anything. Please help.

Thanks in advance.

  • 1
    very vague, could you expand upon "perform certain action". – cmd May 28 '15 at 20:58
  • 1
    You could check the particular column by retrieving its value and comparing it to `null`. – Sebastian Walla May 28 '15 at 21:29
  • If I'm not mistaken you can use `WHERE column IS NULL`. – AdamMc331 May 29 '15 at 16:03
  • @cmd, "perform certain action" means if the column is not null, do something. What I need to do, is not important to mention here. –  May 29 '15 at 19:36
  • @User251989 exactly what you need to do may not, but ... we do need to know if you are doing something in the database or outside at least. There is literally no way to answer this question. you need to be more clear about what you are asking about. – cmd Jun 01 '15 at 20:34

1 Answers1

0

There is PRAGMA table_info(table_name) statement which will return for each column of table_name a result row with following informations (in separate columns):

  1. Column name
  2. Column type
  3. If column can be null or not (that is if it's 0, then the column has NOT NULL constraint)
  4. Default value for the column (will be null, unless column has DEFAULT constraint defined)

The third column would be answer to your question.

Googie
  • 5,742
  • 2
  • 19
  • 31