Null value in a column

i have few master tables in my database.
Each master table has few records in it.
Now i have to display all the columns which have a null value and this needs to be done by checking each record in that table.
if there is any null value column for any row then it should be displyed.
How it can be done using pl sql block?

Hi,
Are you looking something like this...
SQL> Create Or Replace Procedure Column_Test(pTableName In Varchar2)
  2  As
  3   vSQLString Varchar2(32000);
  4   vCounter Number := 1;
  5   vNullable Number;
  6  Begin
  7   For r In
  8   (
  9    Select  COLUMN_NAME
10    From USER_TAB_COLS
11    Where TABLE_NAME  = pTableName
12    And NULLABLE  ='Y'
13   )
14   Loop
15   vSQLSTRING := 'SELECT Count(*) FROM ' || DBMS_ASSERT.sql_object_name(pTableName) || ' WHERE ';
16     vSQLSTRING := vSQLSTRING || r.COLUMN_NAME || ' IS NULL And Rownum<=1';
17   Execute Immediate vSQLSTRING Into vNullable;
18   If vNullable>0 Then
19   Dbms_Output.put_Line(r.COLUMN_NAME);
20   End If;
21   End Loop;
22  End;
23  /
Procedure created.
SQL> execute column_test('EMP');
EMAIL
MGR
PL/SQL procedure successfully completed.
SQL>

Similar Messages

  • Pro*C & SQLDA with NULL value for predicate column

    Hi: I am using a C program to update a table via a dynamic sql (method 4) and SQLDA. In the update statement predicate, I have place holders (as in TBLCOL=:C000). One of the columns in the predicate contains null values, so I set L[n] = 0, V[n] = pData (which pData[0] = '\0'), *(I[n]) = -1, and T[n] = 5 (for text). I cannot find the row that I know is there.
    I cannot change my statement to contain TBLCOL IS NULL, since I don't know ahead of time if I'm looking for rows with null values for this column. The Pro*C manual says that by setting the appropriate *(I[n]) = -1, it indicates to Oracle to simulate the "IS NULL" clause, and update the appropriate rows. In my case, I receive 1403 as SQLCODE when I use TBLCOL=:C000 vs TBLCOL IS NULL. What am I doing wrong? Thank you for your help.

    You should include these columns as well;
    ChangeType (see mxi_changetype)
    ValOwner (repository)
    UserID ("jobid=<>", usermskey, GUI (mmc), DG (dyngrp), reconcile)
    IdAudit  (This is the event task (add and del member for assignments)
    ParentAuditId (AuditID of parent which last updated the attribute, not consistent)
    ChangedBy (Holds the MSKEY of the user which last changed the attribute)
    ExpiryTime
    to make sure you get a fuller picture of the audit record.
    Your selection does not cover all events and descriptions
    br,
    Chris

  • Avoid shrinking of null values in a column....

    I created an RTF template but one of the columns is shrinking if it has null values. Is there any way to avoid this.
    If I replaced the null values with a dot it's workig fine, but the users dont wanna see the dots.
    Any ideas !!!!!!!!!
    Thanks in advance.

    Hi
    Enclose the column in a Table. That should work
    Srini Ramanujam

  • Crystal Report - NULL values mapped to Column names in reports

    Hai,
    I am using rows of data retrived from the SQL Server 2005 Express and sometimes the column names are NULL , I want to set a default value to this NULL value and set it as Data axes label / Group axes values, can some one please help me with this issue.
    Thank you in advance.
    Vijay

    I resolved this issue myself, this can be set as other Data Labels, Group Label or Series Riser's properties too, left-click twice until the blank item is selected and then right click and select "Edit Axis Label" item and here it can edited with the new value(text).

  • Is it possible to filter a table for NULL values in a column? (11g)

    I am using the out-of-the box table filtering provided by ADF Faces RC, but cannot figure out how to filter on Null value that are in the table.
    I have tried "IS NULL" and "= NULL", but nothing works.
    I have a backing bean that intercepts the filtered values before the filter is applied, and I can't set it there either.
    Does anyone know how this is accomplished?

    No, it is not. Worse, many people will view this in any old PDF viewer, most of which won't have overprint preview at all.
    You need to send very clear instructions about this, with specific screen shots - or better, avoid tools and constructions that require it. Probably some wording about "need to view with suitable professional tools" will make the message more palatable.

  • DBA_USERS showing null values in PASSWORD column

    Hi,
    We are running a select query from dba_users table as follows :
    select username from dba_users
    where to_char(expiry_date, 'DD-MON-YY') =
    to_char(sysdate + &expire_day, 'DD-MON-YY')
    and password not in ('EXTERNAL','account-locked')
    and account_status <> 'LOCKED';
    This query was running fine with 10g Version, but after Oracle was upgraded to 11G recently, above query does not return any rows.
    Also, when we remove the condition "and password not in ('EXTERNAL','account-locked')", it works.
    And the values for the PASSWORD column shows null.
    Is this related to Oracle upgrade ?
    Kindly help..
    Thanks,
    Jatin

    I have the same behavior in my 11g db (I have nulls in password column too) as checking docs:
    [url http://download.oracle.com/docs/cd/E11882_01/server.112/e24448/statviews_5081.htm#REFRN23302]Oracle® Database Reference 11g Release 2 (11.2) - DBA_USERS
    I can see:
    USER_USERS describes the current user. This view does not display the PASSWORD, PROFILE, PASSWORD_VERSIONS, EDITIONS_ENABLED, or AUTHENTICATION_TYPE columns....
    PASSWORD      VARCHAR2(30)           This column is deprecated in favor of the AUTHENTICATION_TYPE columnIt seems you need to get this info from somewhere else.
    Edited by: Kecskemethy on Oct 3, 2011 2:36 AM

  • Grand Total with few NULL values in column.

    Hi All,
    In my requirement, I have few null values in the column and I have to show those null values as it is( can't use IfNull function).
    Can I able to grand total in such scenerio..?
    I am using OBIEE 11.1.1.3
    Thanks,
    Archie

    HI Archie,
    Are you using the "Grand Total" option that comes with the view?.I don't think there will be any issue , it will ignore the null values while calculating the total.
    Rgds,
    Dpka

  • SQL Loader: Null value in column

    Have a tab delimited file, in UNIX
    Some of the inbetween columns have null values
    The records are failing to load with null column values.
    I tried:
    col10 nullif col10 ="(null)"
    My control file is:
    load data
    infile 'abc.txt'
    into table XX_data
    fields terminated by X'09' optionally enclosed by '"'
    TRAILING NULLCOLS
    ( col1,
    col2 nullif col2 ="(null)",
    col3)

    Sample data is tab delimited file. For some reason, it has problem reading the second date (+time) column in the same record when there are null values in preceding columns. It says:
    ORA-01841: (full) year must be between -4713 and +9999, and not be 0
    Col1     Col2     Col3     Col4     Col5     Col6     Col7     Col8     Col9     Col10     Col11     Col12
    2000-01-03 10:38:05.733000000          XX AA Change     0     DOG     CAT     R     2000-01-03 10:38:05.733000000     GIRAFFE          MONKEY     COW

  • ORA-01405 in Pro*C Although no Column has NULL Value

    I have a Pro*C program that fetch a cursor from Oracle 8.1.5 into host variables without indicators. I have tried the SQL statement and the SQL will never return any NULL value in any column, however I still got the ORA-01405 error. Any one has any clue?

    Use Indicator variables and let me know if it solves your problem.
    http://docs.jcu.edu.au/oracle/doc/server.804/a58233/dev.htm#2239

  • How can I skip Null values from being part of sorting

    Hi,
    I am using ADF sorting for table, where i dont want to consider null values of that column when i do sorting . Now when I do ascending sort null values for that column are coming first and then the not null values are coming in ascending order.

    User,
    Always mention your JDev version.
    Now when I do ascending sort null values for that column are coming first and then the not null values are coming in ascending order.
    .. which is expected. How would you want it to be? You may probably want to have a custom sortListener for the table and try out. Ex : Custom sort function in ADF table
    -Arun

  • Clarification needed on the behaviour of count with null values

    Hi friends,
    I am confused about the result given by the count aggregate function when dealing with null. Please can anybody clarify about that to me. Here is what i tried
    CREATE TABLE Demo ( a int);
    INSERT INTO Demo VALUES
    (1),
    (2),
    (NULL),
    (NULL);
    SELECT COUNT(COALESCE(a,0)) FROM Demo WHERE a IS NULL; -- Returns 2
    SELECT COUNT(ISNULL(a,0)) FROM Demo WHERE a IS NULL; -- Returns 2
    SELECT COUNT(*) FROM Demo WHERE a IS NULL; -- Returns 2
    SELECT COUNT(a) FROM Demo WHERE a IS NULL; -- Returns 0
    Please can anybody explain me why the result is same for the first three select statements and why not for the last select statement. And what does COUNT(*) actually mean?
    With Regards
    Abhilash D K

    There is a difference to the logic when using a column name versus "*" - which is explained in the documentation (and reading it is the first thing you should do when you do not understand a particularly query/syntax).  When you supply a column
    (or expression) to the count function, only the non-null values are counted.  Isnull and coalesce will obviously replace a NULL values, therefore the result of the expression will be counted. 
    1 and 2 are effectively the same - you replace a null value in your column with 0 and each query only selects rows with a null column value.  The count of non-null values of your expression is therefore 2 - the number of rows in your resultset.
    3 is the number of rows in the resultset since you supplied "*" instead of a column.  The presence of nulls is irrelevant as documented.
    4 is the number of non-null values in the resultset since you DID supply a column.  Your resultset had no non-null values, therefore the count is zero.

  • Using default values for a column

    Hi,
    I am using PL/SQL Developer, where for some columns in a table I've defined 0 as default value.
    After running some queries on the table (insert,update) I realized that all the columns that are supposed to have 0 value (default), actually have NULL value.
    Please advice about possible reason.
    Thanks

    Hi,
    You might have explicitly inserted a NULL value in those columns. Have a look at the below test case:
    SQL> create table test(a number, b number default 0, c number default 1);
    Table created.
    SQL> insert into test (a) values (10);
    1 row created.
    SQL> select * from test;
             A          B          C
            10          0          1
    SQL> insert into test (a, b) values (10, null);
    1 row created.
    SQL> select * from test;
             A          B          C
            10          0          1
            10                     1
    SQL> insert into test (a, b, c) values (10, null, null);
    1 row created.
    SQL> select * from test;
             A          B          C
            10          0          1
            10                     1
            10
    SQL> insert into test (a) values (20);
    1 row created.
    SQL> select * from test;
             A          B          C
            10          0          1
            10                     1
            10
            20          0          1Regards

  • Oracle Discoverer: How to handle null value

    In Oracle Discoverer, I pull data from a folder. When I hit Null value for a column, I want to replace it with data from another folders column. Something like the functionality of "nvl" of a SQL statement. How can I do the following query in Discoveror :
    example: select nvl(table1.column1,table2.column2) from table1, table2
    where table1.column7 = table2.column7.

    Hi,
    You first need to include any column from folder table2 into your report so that Discoverer will do the join. (This assumes the join between table1 and table2 is set up in your EUL). Then you can create a calculation containing nvl(table1.column1,table2.column2) . You can then remove the column from folder table2 and the join will stay in your workbook.
    Hope that helps,
    Rod West

  • Oracle Discoveror: How to handle null value

    In Oracle Discoveror, I pull data from a folder. When I hit Null value for a column, I want to replace it with data from another folders column. Something like the functionality of "nvl" of a SQL statement. How can I do the following query in Discoveror :
    example: select nvl(table1.column1,table2.column2) from table1, table2
    where table1.column7 = table2.column7.

    Hi,
    You first need to include any column from folder table2 into your report so that Discoverer will do the join. (This assumes the join between table1 and table2 is set up in your EUL). Then you can create a calculation containing nvl(table1.column1,table2.column2) . You can then remove the column from folder table2 and the join will stay in your workbook.
    Hope that helps,
    Rod West

  • Retreive non-Null values

    Hi everybody
    How to retreive the values those are not Null from a table??
    I mean I want to display non-Null values from a column or set of columns(if possible)??
    Thanks in advance

    But I don't have any criteria ... But you have criteria - namely to retrieve not null values!
    Maybe you need to be more clear (with sample in- and output) of what you'd actually like to achieve.

Maybe you are looking for

  • Problem: I just get a validation screen endlessly coming up when trying to open cc apps - pls help!

    I can't open any adobe cc products - I just get a validation screen endlessly coming up. Tride technical help, but they couldn't help, tried all this but no use: Sanjay kumar: Hello. Welcome to Adobe Technical Support. Sanjay kumar: Hi Emma! Emma Bat

  • Installing Microsoft Office on 2 user accounts

    Hi I have 2 user accounts on a Mac Mini (both administrator) I have installed Microsoft Office 2011 with Outlook but it has only shown up on one of user accounts. There was no option to install on both accounts when I installed it. Is there anyway to

  • Field Bus. Area is a required field for G/L account 1000 30400011

    07.09.2007 Hi, When I am releasing an invoice for accounting I get the following error "Field Bus. Area is a required field for G/L account 1000 30400011". 1000 is the company code & 30400011 is the G/L account. Can anyone help me to sort  this probl

  • Fatal Error Message Now when trying to use Boot Camp

    I have a new issue that just cropped up. I have been using Boot Camp for some time when I just need to be concentrating on the XP Pro side of the system. However, I typically use Parallels and get in just fine. Yesterday, I attempted to use Boot Camp

  • Want to install a wireless card in a MDD

    hi i would like to install a wireless card into my powermac G4 MDD. i bought a an external usb wireless but i could not find a driver for it and had to return it. what kind of wireless card can i install that will be found by the system or where driv