What is in the column, empty string, null or ....?

I am using Oracle 11.2, have one table tb_class as following:
TB_CLASS (id number(3), nm varchar2(32), seqNum number(3));
1, ,212
2,'as', 12
3, 'qq', 12
select * from TB_CLASS where id=1 and nm=null; ...no row selected
select nvl(nm) from TB_CLASS where id=1; ...1 row selected
Any one know what is in column nm for row id=1? I thought it is empty string, but why it returns no row in the first query?
Thanks!

1) In Oracle there is no difference between NULL and the empty string.
2) NULL is never equal to anything (including another NULL). NULL is never unequal to anything (including another NULL). You need to use the IS NULL and/ or IS NOT NULL operators in order to look for NULL values
SELECT *
  FROM tb_class
WHERE nm IS NULLor
SELECT *
  FROM tb_class
WHERE nm IS NOT NULLOf course, it is also possible that you are stating that the NM column contains one or more spaces or that it contains one or more non-printable characters rather than a NULL. That's why you were asked what dump(nm) returns
Justin

Similar Messages

  • Empty string == NULL ???!?!?!?!??!

    Hi SQlers ...
    I'm using Oracle 8.1.7 ... and Oracle maps the literal empty
    string value, to the NULL value ... it that the expected result?
    simple example:
    SELECT 1 from dual where ('' is null)
    I've tried the same on others rdbms, and of course, the
    result is not the same.
    thanks in advance
    saludos
    dario estepario ...

    Yup. In Oracle the empty string '' and NULL are identical, though they periodically threaten that this may change in the future.
    Justin

  • Create a view, some of the columns default are NULL

    Windows XP/10g 10.2.0.1.0
    I have a table tab1(test1, test2, test3)
    And, I need to create a views as:
    create or replace VW1(test1, test2, viewtest1, viewtest2) as (select test1, test2, viewtest1, viewtest2 from tab1, dual);
    And need the column value viewtest1 and viewtest2 to be default as null.
    Thanks.

    Are you looking for something like this ?
    create or replace VIEW VW1(test1, test2, viewtest1, viewtest2) as
             (select test1, test2, NULL, NULL from tab1);

  • One of the Column returned as NULL from SQL Server 2008

    Hi,
    I have written a stored procedure in SQL server 2008. The procedure reads data into a temporary table @MeterWiseConsumptionBetwDates as shown
    SELECT @sqlstatement =     'SELECT '''@MeterName''', CAST ( MAX('@Meterfield') AS FLOAT )-CAST ( MIN('@Meterfield') AS FLOAT )
                                  FROM KWH
                                  WHERE     KWH.timestamp BETWEEN @StDate AND @EndDate'
    INSERT INTO @MeterWiseConsumptionBetwDates(MeterName,Consumption)
    EXEC sp_executesql @sqlstatement, N'@StDate datetime, @EndDate datetime', @StDate, @EndDate
    Now when I execute the stored procedure in SQL Server Management Studio it returns all the columns from the table @MeterWiseConsumptionBetwDates, but when I execute the procedure in MII it returns the values in the Consumption column as null. The MeterName column is returned correctly in both the cases.
    Please help.
    Thanks

    Glad to hear that it is working.  You should be able to use
    execute <proc name> '[SD]'
    [SD] and [ED]
    are the query date tokens, so whatever you have assigned on the Date Range tab will be passed to the query.
    Jamie
    Edited by: Jamie Cawley on May 9, 2011 9:40 AM

  • Fetch LONG column into String -- null pointer

    Case 1/ Fetch a LONG column directly from embedded SELECT statement
    Result: iterator.my_long_column() returns the expected data
    Case 2/ Fetch the same LONG column from a REF CURSOR that was returned by a stored function
    Result: For the first row fetched, iterator.my_long_column() now returns a null pointer, but all the other columns in the query (VARCHAR2s) still return the expected data. For subsequent rows everything works fine...
    Any ideas?

    Hi
    I faced similar error  mistake was same as you did that giving it to string value ,
    <MethodName> obj=new <MethodName>(modelobject);
    List L1=new ArrayList();
    ArrayOfString arrStr=new ArrayOfString(<modelobject>);
    String_Item it=new String_Item(<modelobject>);
    item.setItem(<Value1>); L1.add(it);
    it=new String_Item(<modelobject>);
    item.setItem(<Value2>); L1.add(it);
    etc..
    arrStr.set<setter>(L1);
    obj.set<ArrayOfString(arrStr);
    So it require a object of type Collection (List ...)
    Hope it help you
    Best Regards
    Satish Kumar

  • Need to change the column constrain from NOT NULL to NULL

    Hi,
    My requriment is I have to change the column constraint (NOT NULL) to NULLable (column having data), I used below query for that
    alter table table_name modify transaction_cost2 default null
    even command is successfull, but column constrain is still NOT NULL.
    can you any one help on this.. ( steps to change column constain from not null to null)
    Thanks,

    ALTER TABLE table_name
      MODIFY( transaction_cost2 NUMBER NULL )That assumes that the data type of the TRANSACTION_COST2 column is NUMBER-- you'll want to use the current data type if it is something else. I'm hoping that the fact that you have a column named TRANSACTION_COST2 doesn't imply that you have an incorrectly normalized data model. But the name of the column certainly implies that you do.
    Justin

  • To Check column is NOT NULL

    Hi
    I am trying to find out whether table column is NOT NULL or Not using ALL_CONSTRAINTS VIEW.But the problem is I am getting 'C' for the columns with NOT NULL and the columns with Check constraint. IF I want to find out the column is NOT NULL or not what is the best way.Help is appreciated.
    thanks
    srinivas vundi

    Hi
    Inorder to filter the records I am trying to use SUBSTR(SEARCH_CONDITION,-4) LIKE 'NOT NULL'.But it is throwing error. How do I filter the records where value is '%NOT NULL'. Please respond .
    thanks
    srinivas

  • Discoverer plus  report does not sum up the column

    Hi All,
    I am running the discoverer report from discoverer plus (web version) and was
    trying to use the sum function to sum the total amount of the report.
    The sum function does not work and it only display Cell
    Sum: (blank) with no actual data.
    When i checked the report details some columns are calculated based on the columns which i want to sum up.
    My query uses CASE function to calculate one of the columns.
    I changed the aggregation behavior setting to "Show the sum of the calculated values from the contributing cells "
    then also i'm not able see the totals.
    Any ideas please share with me.
    Thanks in advance,

    Hard to answer your question without seeing what you are trying to do. Issues like this are often better reported to Oracle support, where they can get a web sesison going and be able to see what you see on your computer. Would be helpful to illustrate exactly what your detail looks like and how you are trying to create your sum. There could be several possible issues that could cause your problem, so all I can do is speculate some. Are you trying to sum one column, or are you creating multiple totals (for multiple columns)? Do you have any rows in the column with a NULL value? NULL values will be a problem when trying to sum up a column. You would need to convert the NUll value to something else, probably a zero. That would be the first thing I would look at. Hope that helps a little bit.
    John Dickey

  • Apex 4.1. cannot see the details of not null validations generated by apex

    Hi there,
    I have worked with APEX 3 quite a while. Now I move to new place, and they use APEX 4.
    I am currently doing the Advanced Tutorials - Issues Tracker (written for 3.2 ) on an APEX 4.1.
    I am quite impressed with a lot of enhanced features of APEX 4.
    However, I think I got quite confused about the NOT NULL vaildations.
    In the tutorials, they said when creating a form based on a tablle of which the columns have NOT NULL constraint, it will automatically generate NOT NULL validation.
    But when I extend the validation section (in both Component View and Tree View), I cannot see any vaildation there.
    So I go a head and create some NOT NULL validations for all NOT NULL fields.
    Guess what, when I test the form, I got duplicate error messages.
    I get these
         6 errors have occurred
    Project Name must have some value. (Go to error)
    Start Date must have some value. (Go to error)
    Target End Date must have some value. (Go to error)
    Please provide project name. (Go to error)
    Please provide project start date. (Go to error)
    Please provide target end date. (Go to error)
    My validation has error message "Please provide project name" while the automatic one has "Project Name must have some value".
    The issue is I cannot find where the automatic validation is.
    What if I want to customise the error message rather than just "#Label# must have some value".
    Do any of you have any ideas why ?
    I guess I must have chosen something wrong during page generation.
    It could be quite simple but I don't know where to find the place that turn on/off the automatic not null validation, or at least customize these automatic error messages.
    I currenly develop the application using workspace admin account.
    Thanks a lot in advance.
    Ann

    I found it. Turn out to be the Settings, choose No for Required Value.

  • Conditional column display in report using column substitution string

    Hi everone,
    I was wondering if it's possible to display a column conditionally, based on a values in another column of the same report.
    Can you use the column substitution strings or does the condition strictly require SQL, PL/SQL
    or page item values?
    kind regards,
    Cleo

    I dont think we can add a condition to display the column in a report based on the other column of the same report,
    Just add a (CASE WHEN <your condition satisfies> THEN column ELSE null END) in your report source for the column you want to display conditionally.
    --Mahesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Problem in summation on a column with possible null values

    Hi,
    I want to do summation on a column.
    If I use <?sum(amount)?>, if there is any null value,its giving NaN as output.
    From the forum I got the below syntax
    <?sum(AMOUNT[number(.)!='NaN'])?>
    but it is also not giving me the expected result. Its always displays 0.
    I want some thing like sum(NVL(amount,0)). Could some body please help me out?
    Thanks in Advance,
    Thiru

    If the column has many, many null values, and you want to use the index to identify the rows with non-null values, this is a good thing, as a B*Tree index will not index the nulls at all, so, even though your table may be very large, with many millions of rows, this index will be small and efficient, cause it will only contain index entries for those rows where the column is not null.
    Hope that helps,
    -Mark

  • JTable - Resize rows the same way as the columns

    Hi!
    I have run into a very frustrating problem and have tried to solve this for many hours but can't come up with a good solution. If there is anyone that can help me on the right track I will be very grateful!
    When I'm using a JTable it provides good "graphical" functionality to handle resize of colums, but when it comes to resize rows it is not available.
    I have found a solution for the row height adjustment in the following post: [http://forums.sun.com/thread.jspa?forumID=257&threadID=453665]
    That solution only partially work in my case because of the following:
    The JTable exists inside a JInternalFrame and the JTable should not be able to get bigger then the actual size of the InternalFrame it is put in (so no scrollbar).
    The problem with the solution above is that the JTable total height will also expand when a row is resized (contrary to what happens when the columns are resized), ending up with a JTable that is bigger then the InternalFrame.
    So my question is:
    Is it possible to provide the same ("graphical") resize functionality for rows as for columns in a JTable? Or any row resize functionality that prevent the JTable from getting bigger then the container it is placed in?
    Thanks for your time!
    Best regards,
    Marcus

    Thanks for the fast answer!
    Yes, that would solve the height expanding problem. Thanks!
    It would be even better though if the row resize functionality would behave the same as the column resize (for consistency). For example: If a row is resized the other rows will get smaller so they all fit into the InternalFrame.
    It has to be some easy way to do this. I have started on a solution with component listeners etc. (to track resize) but it is quite hard to get it right and I keep getting the feeling I reinventing the wheel all over again:(
    Any ideas out there?

  • Find out varchar2 string NULL columns and Empty columns

    Hi dev's ,
    my requiremnt is to find out the string columns Names of whose storing NULL values and EMPTY strings. for that i had written below code. it's getting some error.
    SET ECHO OFF;
    SET FEEDBACK OFF;
    SET SERVEROUTPUT ON;
    SET VERIFY OFF;
    SET PAGES 0;
    SET HEAD OFF;
    spool D:\stringnull.csv
    DECLARE
      v_tab_indent NUMBER(5);
      v_col_indent NUMBER(5);
      v_val1       VARCHAR2(20);
      v_val2       VARCHAR2(20);
      v_query1     VARCHAR(500);
      v_query2     VARCHAR(500);
    BEGIN
      --DBMS_OUTPUT.ENABLE(100000);
      SELECT MAX(LENGTH(table_name))+1,MAX(LENGTH(column_name))    +1
      INTO v_tab_indent,v_col_indent
      FROM user_tab_columns
      WHERE data_type='VARCHAR2';
    FOR i IN
      (SELECT table_name,
        column_name
      FROM user_tab_columns
      WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
      ORDER BY table_name,
        column_name
      LOOP
        v_query1:='SELECT NVL('||i.column_name||',0) AS VAL    
                  FROM '||i.table_name||' where '||i.column_name||' IS NULL';
        v_query2:='SELECT '||i.column_name||' AS VAL    
                  FROM '||i.table_name||' where '||i.column_name||'=''''';
        --dbms_output.put_line(v_query1);
       -- dbms_output.put_line(v_query2);
        EXECUTE immediate v_query1 INTO v_val1;
        EXECUTE immediate v_query2 INTO v_val2;
        dbms_output.put_line (rpad(i.table_name,v_tab_indent,' ')||','||rpad(i.column_name,v_col_indent,' ')||' ,'||v_val1||','||v_val2);
      END LOOP;
    END;
    Spool OFF
    Set echo on
    Set feedback onERROR:
    Error report:
    ORA-01403: no data found
    ORA-06512: at line 31
    01403. 00000 -  "no data found"
    *Cause:   
    *Action:
    set feedback onpls help me on this issue..
    Thanks,

    Example:
    SQL> DECLARE
      2    v_val       VARCHAR2(20);
      3    v_query1     VARCHAR(32767);
      4  BEGIN
      5   FOR i IN (SELECT table_name, column_name FROM user_tab_columns
      6             WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
      7             ORDER BY table_name, column_name
      8            )
      9   LOOP
    10     v_query1 := 'SELECT count(*) FROM '||i.table_name||' where '||i.column_name||' IS NULL';
    11     EXECUTE immediate v_query1 INTO v_val;
    12     dbms_output.put_line(rpad(i.table_name,30,' ')||' : '||rpad(i.column_name,30,' ')||' : '||v_val);
    13   END LOOP;
    14  END;
    15  /
    CHILD_TAB                      : DESCRIPTION                    : 0
    DEPT                           : DNAME                          : 0
    DEPT                           : LOC                            : 0
    EMP                            : ENAME                          : 0
    EMP                            : JOB                            : 0
    MYEMP_OLD                      : ENAME                          : 0
    MYEMP_OLD                      : JOB                            : 0
    MYNULLS                        : ENAME                          : 0
    MYNULLS                        : JOB                            : 4
    PARENT_TAB                     : DESCRIPTION                    : 0
    T                              : CHAR_VALUE                     : 0
    TABLE1                         : COL1_DESC                      : 0
    PL/SQL procedure successfully completed.

  • Empty string in NOT NULL column

    I'm migrating data to Oracle 9i from a database engine that supports emtpy strings in column with NOT NULL specified in the DDL. I would have thought Oracle would support this, but any attempt to put empty string data into a column created with NOT NULL is returning a 'column does not support nulls'-type error.
    Is there an option to allow this, or does Oracle simply not support this and assumes blank is null?
    Thanks

    I would have thought Oracle would support this, but any attempt to put empty string data into a column created with NOT NULL is returning a 'column does not support nulls'-type error.In Oracle Null means null nothing not even an empty String.
    Yes DB's like Ingress supports this. But I think Oracle is right.
    Is there an option to allow this, or does Oracle simply not support this and assumes blank is null?I am not aware of any options as it is against the basic principles.
    you can find work arounds to do the migration. But storing a blank NO.
    Good Luck
    Vij

  • What is difference between Null String and Empty String ?

    Hi
    Just i have little confusion that the difference bet'n NULL String and Empty String ..
    Please clear my doubte.
    Thankx

    For the same reason I think it's okay to say "null
    String" and "empty String "as long as you know they
    really mean "null String reference" and "empty String
    object" respectively. Crap. It's only okay to say that as long as *the one you're talking to" knows what it really means. Whether you know it or not is absolutely irrelevant. And there is hardly any ambiguity about the effects that a statement like "assign an object to a reference" brings. "Null String" differs in that way.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • SSRS Expression help

    Hello, Is there anyway to default to the first day of the month in a SSRS expression.  I'm looking to do the reverse of the EOMONTH() function. The date value is coming from a parameter @BegDate and formatted YYYY-MM-DD.  So if the parameter is set t

  • How can i use my old iMac as a extended desktop display for my new iMac?

    I recently purchased a 21.5 in iMac and wanted to use my old iMac as a extended desktop. My new iMac has thunderbolt and USB 3.0 connections while my old iMac has firewire (400 and 800), USB 2.0 and mini-DVI. Is this posible?

  • E-mail addresses for additional domains

    We own 3 domain names and I'm confused on how to set up e-mail for a user who uses all 3 domains. They use the same short name for all 3 accounts. We have the domains up and running. example: [email protected] [email protected] [email protected] How

  • [SOLVED] dhcpcd exits with no daemon process ... but still works

    This is in the newbie corner as I'm baffled by this and not even well enough informed to know where to gather information. Very recently the behavior of dhcpcd changed.  Previously, it would daemonize and remain in the background: it would show up in

  • Lightroom slideshow goes black

    When I try to run Slideshow in Lightroom, the screen goes black and no images are shown. This happens no matter what type of files I am trying to show, i.e. RAW, TIFF, JPEG.