Home > database >  SQL database to calculate rate of null values
SQL database to calculate rate of null values

Time:09-16

Want to ask, I think it's time to a stored procedure can be counted a null values of each field in the table, is the number of null values than the total number, but how can you do it by variable cycle each field in the table? Ask god to reassure it

CodePudding user response:

Dynamic SQL, the field name to obtain through user_tab_columns view

CodePudding user response:

But if the real time requirement is not high, recommend to collect statistics, query user_tab_col_statistics view to calculate the rate of a null value

CodePudding user response:

reference 1st floor minsic78 response:
dynamic SQL, the field name by user_tab_columns view to obtain
I think is from what you said this view can take out every line of figures one by one, each line that is the field name, take this as a variable in through another select count (variable) from table where... Is null/conut (1) the from table, but how to implement, can take step by step in the cycle of data needs to be and how to write? Write a stored procedure for great god to reassure thank you

CodePudding user response:

reference qq_43621306 reply: 3/f
Quote: refer to 1st floor minsic78 response:
dynamic SQL, the field name by user_tab_columns view to obtain
I think is from what you said this view can take out every line of figures one by one, each line that is the field name, take this as a variable in through another select count (variable) from table where... Is null/conut (1) the from table, but how to implement, can take step by step in the cycle of data needs to be and how to write? Write a stored procedure for great god to reassure thank you


You ask is grammar?
  • Related