Difference between null string and empty string??
what is the major difference between null string and an empty string??
I wrote the following simple program and I could see some different output.
Other than that, any other differences that we should pay attention to???
C:\>java TestCode
Hello
nullHello
public class TestCode
public static void main(String[] s)
{ String s1 = "";
String s2 = null;
System.out.println(s1 + "Hello");
System.out.println(s2 + "Hello");
}
The difference is that an empty String is just empty but a null String has no value (i.e. it is not instantiated) this has signifigance since all Strings are objects.
Similar Messages
-
Difference between null vector and empty Vector
What is the diffrence between null vector and empty vector.
null vector means the JVM doesn't allocate memory.It doesn't exist
in memory. NO instance!
empty vector means the JVM allocated memory.It exists in memory.
it's a instance than is accessabel.But only have on elements.
GL&HF. -
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.
ThankxFor 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. -
Difference between null layout and absolutelayout
hello
I would like to know the difference between the null layout and the absolutelayout
thank you in advancehttp://www.google.com/search?q=absolutelayout
Next time, please use the search yourself.Do I have to consider this as answer Yes.
notice that I asked for the difference between both
of the layout and not about
absolutelayout only Third link, advertised by
"I think AbsoluteLayout does more than just setting Layout to null. AbsoluteLayout may even accomodate for changes in font sizes etc. ..."
already should give you something to think about.
Furthermore, the search shows that there are several different classes named AbsoluteLayout (ADF, SWT, BUI, samskivert...), and you didn't specify which one you're talking about.
Still think this wasn't an answer?
I guess I should stop assuming that you have a brain of your own. -
OSB to Object Types: difference between NULL value and not available
Hello all,
I have a question about Object Types. More specifically, how to differentiate between an empty value (null) and a string not available.
This is my case:
I have created an object type with three parameters.
CREATE OR REPLACE TYPE OSB_EMP_OBJ_TYPE AS OBJECT
(EMP_ID NUMBER
,DEPT_ID NUMBER
,ORDER_ID NUMBER
,CONSTRUCTOR FUNCTION OSB_EMP_OBJ_TYPE
RETURN self as result
/I would like to see what happens when I put an empty string into emp_id, NULL into DEPT_ID and nothing into ORDER_ID.
To do so I have this test script:
declare
p_emp OSB_EMP_OBJ_TYPE := OSB_EMP_OBJ_TYPE();
begin
p_emp.EMP_ID := '';
p_emp.DEPT_ID := null;
-- p_emp.ORDER_ID := null;
if p_emp.EMP_ID is null
then
dbms_output.put_line('Empty');
end if;
if p_emp.DEPT_ID is null
then
dbms_output.put_line('NULL');
end if;
if p_emp.ORDER_ID is null
then
dbms_output.put_line('Not available');
end if;
end;The result of this is:
Empty
NULL
Not availableIt seems that Oracle treats all three situations alike. What I would like to achieve is a way to see that p_emp.ORDER_ID was not initialized.
To elaborate a bit: in our production system this procedure would be called from OSB and the object type would by the input for that procedure. Our database version is 10.2.0.5.0.
Our procedures look something like this:
procedure p_procedure ( p_emp in osb_emp_obj_type )
is
begin
do_something;
end;Can anyone tell me if there is a way to achieve this, so I can see whether or not a value in the object type was filled?
Thanks in advance!Darn...
Eventually we want to use this for an update procedure. The client gets all current data from the database by calling a webservice that (using OSB) selects the data from our database. What we want to achieve is that the client can update that data, by returning only the changed fields to an update procedure.
We then handle an empty tag to update the field to null, and we ignore missing tags.
OSB itself can handle this, but PL/SQL can't.
I'm now thinking of adding an indicator to each optional field (clear_field_yn). OSB can still check for empty tags or missing tags. When a tag is empty, it's corresponding indicator will be set to 'Y'. If the tag is missing, then it will be set to 'N'.
Is that a solution to consider, or is there a much simpler approach possible? -
Differnce between null string and an empty string??
what is the major difference between null string and an empty string??
I wrote the following simple program and I could see some different output.
Other than that, any other differences that we should pay attention to???
C:\>java TestCode
Hello
nullHello
public class TestCode
public static void main(String[] s)
{ String s1 = "";
String s2 = null;
System.out.println(s1 + "Hello");
System.out.println(s2 + "Hello");
}There's a big difference between the two. A null String isn't pointing to an object, but an empty String is. For example, this is perfectly fine:
public class TestCode
public static void main(String[] args)
String s = "";
System.out.println(s.length());
} It prints out 0 for the length of the String, just as it should. But this code will give you a NullPointerException:
public class TestCode
public static void main(String[] args)
String s = null;
System.out.println(s.length());
} Since s isn't pointing to anything, you can't call its methods. -
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. -
Difference between Null and null?
What is the difference between null and NULL?
When is each used?
Thanks,veryConfused wrote:
There is a null in java, but no NULL. null means no value. However, when assigning value, the following is different:Although the empty String has no special role. Null means, the referential type is not assigned (doesn't refer) to a specific object. The empty String is just another object though, so seeing it or pointing it out as something special when it actually isn't at all (no more special than new Integer(0) or new Object[0]) just adds to the confusion. -
Return the difference between two strings
Is it possible to return the difference between two strings?
For example
String one = "We went for a walk";
String two = "We went for a run";
compare "two" to "one" returns "walk"
compare "one" to "two" returns "run"I need to return the difference of two strings, one prior to editing and one after editing.
Then I want to return any difference between the two, which will be the effect of the editing.
Cheers AlexInteresting problem. Before you start writing any code, make up a whole bunch of test case pairs. Decide what the difference between the pairs is. When you start seeing patterns, analyse them. After a while you may have enough data to start writing your program. Here's one test case to get started with:"I saw the cat eat a rat"
"My cat is hungry" -
Difference between Null in c and Null in Oracle
Hi,
Can any one tell me the difference between NULL in C language and NULL in Oracle
Rds,
Naga> Null is some garvage value in oracle.
Not sure what you mean.
AFAIK and not being a C programmer myself, isn't null CHR(0) in C? I'm not sure the two concepts (SQL null and C null) have anything in common. -
What is the difference between "= NULL" and "IS NULL" in SQL?
Hi,
I believe there is a difference between "= NULL" and "IS NULL" comparsion, but I couldn't find it. Anyone knows the difference?
Thanks,
DennyAha, thanks:
SQL> create table william_test_tab (col binary_double);
Table created.
SQL> insert into william_test_tab
2 select rownum / (rownum - 1) from user_tables where rownum < 4;
select rownum / (rownum - 1) from user_tables where rownum < 4
ERROR at line 2:
ORA-01476: divisor is equal to zero
SQL> insert into william_test_tab
2 select 1d * rownum / (rownum - 1) from user_tables where rownum < 4;
3 rows created.
SQL> select * from william_test_tab;
COL
Inf
2.0E+000
1.5E+000
3 rows selected.
SQL> select * from william_test_tab where col is infinite;
COL
Inf
1 row selected.
SQL> -
What's difference between JPanel.remove(); and JPanel = null
nice day,
how can remove JPanel (including its JComponents), safe way, can you explain the difference between JPanel.remove () and JPanel = null,
1/ because if JPanel does not contain any static JComponents
2/ or any reference to static objects,
then works as well as JPanel.remove or JPanel = null,
or what and why preferred to avoid some action (to avoid to remove or to avoid to null)mKorbel wrote:
nice day,
how can remove JPanel (including its JComponents), safe way, can you explain the difference between JPanel.remove () and JPanel = null, Remove the JPanel from the container it was part of and make sure you do not keep any references to it from your own classes. Don't make it any more difficult than it has to be. -
Difference between PRIMARY KEY and UNIQUE KEY with NOT NULL
What is the difference between PRIMARY KEY and UNIQUE KEY with NOT NULL constraint?
Message was edited by:
Nilesh HoleAnswer for the master!!!
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:8743855576462
Thanks,
Karthick -
Difference between conn.close() and conn=null;
Hi All,
Can anybody please let me know the difference between conn.close()
and conn=null;
where conn is reference to Connection.
Thanks and Regards
-sunjavadeveloperThanks for your response.
Is there any other good approach to close() & then
null the Obj. can u give us your opinion.
finally
try{
if(dbconn != null) dbconn.close();
if(stmt != null) stmt.close();
if(rs != null) rs.close();
if(con != null) con.close();
catch (Exception e)
logger.fatal(e.getMessage(),e);
throw new Exception ("Exception -- Vendor.java --
a -- authenticate -- " + e.getMessage() );
dbconn = null;
rs = null;
stmt=null;
con = null;
Putting the close() calls in finally block is good, but having them in individual try/catch blocks is better. That way you can still try to close the connection if closing the statement throws an exception.
I don't bother setting them to null. GC is smart enough to know that they've gone out of scope. I don't think it helps.
% -
Difference between list.clear() and new instance
In the below code,
List<String> test = new ArrayList<String)();
list.add("one");
list.add("two");
list.add("three");
list.clear();
(or)
list = new ArrayList<String)();
list.add("four");
list.add("five");
What is the difference between List.clear() and creating new instance for list?1. Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
2. Invoking clear() sets all the elements of the ArrayList to null and resets the size to 0. public void clear() {
modCount++;
// Let gc do its work
for (int i = 0; i < size; i++)
elementData[i] = null;
size = 0;
}(modCount is used to detect concurrent modification and throw an Exception when needed)
Constructing a new ArrayList creates a new, different, empty ArrayList.
In many situations they might be equivalent, but not in a case where you have two or more variable references to the same ArrayList. Example (watch out for typos)ArrayList<String> stringsA = new ArrayList<String>();
ArrayList<String> stringsB = stringsA;
: // add elements to stringsA
: // stringsB refers to the same populated list
stringsA.clear(); // stringsB refers to the clear()ed list
: // add elements to stringsA again
stringsA = new ArrayList<String>(); // stringsB still refers to the populated listdb
Maybe you are looking for
-
Can't find wfaqupfix.sql
hi ! Iam upgrading the database from 11.1 to 11.2.x in EBS12 on solaris sparc 64bit. I am following the post install steps as stated in document id 1058763.1 and got stuck on step 21 cause the $FND_TOP/patch/115/sql/wfaqupfix.sql file is missing. tha
-
When entering a series of numbers, every time the space bar is entered, the keyboard returns to the alpha mode. How does one lock it in numeric mode. I've tried every combination, in "settings>keyboard" with no luck.
-
Every time I try to sync music to my Zen I get a message that says the device is full whether I'm using wmp or another program and I can't format the player either,I have the latest firmware .Any help would be greatly appreciated.
-
Graphics fail to appear in received emails and no links to them. They do appear if I forward the message. I also get a high memory usage by fire fox quite often.
-
Variant Config- Dependcy based on Material quantity
Hi , I have a specific requirement for variant config. If we have a material A1 and it has variants as b1( values 5/10/15) and c1(red/blue/green). when i create the sales order for A1 and enter 5 in the quantity field , then the variant B1 should be