Difference between MySQL null and JAVA null
When I create a new record in my MySQL db and some of the values are not intered, MySQL thinks of them as null. Java makes an error when the variable is used. But when I set the values to ' ' (blank) java sees it as null and makes no error.
Is there a way around that??????
BR Soren
"" and null is totally different thing.
you can try checking for null instead of "".
Similar Messages
-
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.
% -
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. -
What is difference between C# Gzip and Java swing GZIPOutputStream?
Hi All,
I have a Java swing tool where i can compress file inputs and we have C# tool.
I am using GZIPOutputStream to compress the stream .
I found the difference between C# and Java Gzip compression while a compressing a file (temp.gif ) -
After Compression of temp.gif file in C# - compressed file size increased
while in java i found a 2% percentage of compression of data.
Could you please tell me , can i achieve same output in Java as compared to C# using GZIPOutputStream ?
Thank a lot in advance.797957 wrote:
Does java provides a better compression than C#?no idea, i don't do c# programming. and, your question is most likely really: "does java default to a higher compression level than c#".
Btw what is faster compression vs. better compression?meaning, does the code spend more time/effort trying to compress the data (slower but better compression) or less time/effort trying to compress the data (faster but worse compression). most compression algorithms allow you to control this tradeoff depending on whether you care more about cpu time or disk/memory space. -
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> -
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 -
What is the difference between mysql and mysqli
hello can any one tell me What is the difference between mysql and mysqli ? i googled but i cant find any
Edited by: 994030 on Mar 14, 2013 3:43 PMYes. they are the same.
-
Difference between pack/unpack and T2P (copyConfig/copyBinary)
Hi Experts,
I have a requirement to clone WLS 10.3.3 running SOA and OHS. I am facing some issues (encountering NPE on running copyBinary.sh and extractMovePlan.sh file is missing) while doing T2P for OHS. I see pack.sh and unpack.sh can be used to make WLS domain templates and create new domains on different machines/hosts.
Please let me know what is the difference between the two approaches T2P and pack.sh/unpack.sh. Also please suggest which is the recommended approach.
Note: I am new to WLS, so please don't mind if my question is trivial or doesn't make sense.
Thanks
RathnamBelow is the Stack Trace for NPE:
=======================================================================================
Null Point Exception Error:
bash-3.2$ /than8o/fmw/product/111/oracle_common/bin/copyConfig.sh -javaHome /than8o/fmw/jrmc-4.0.0-1.6.0 -al /ptsadmin/FMW_clone/config/OHS_CopyConfig.jar -sourceInstanceHomeLoc /than8o/fmw/product/111/ohs_instances -sourceComponentName ohs1
Log File: "/tmp/CLONE2012-09-19_03-56-21PM-LOG/CLONE2012-09-19_03-56-21PM.log".
Error File: "/tmp/CLONE2012-09-19_03-56-21PM-LOG/CLONE2012-09-19_03-56-21PM.error".
To proceed, type "yes":yes
INFO : Sep 19, 2012 3:19:23 PM - CLONE-21095 Create archive for instance1@ohs1 started ...
java.lang.NullPointerException
at oracle.as.clone.classloader.CloningFrameworkClassLoader.getClonableEntityTypes(CloningFrameworkClassLoader.java:162)
at oracle.as.clone.classloader.CloningFrameworkClassLoader.<init>(CloningFrameworkClassLoader.java:254)
at oracle.as.clone.classloader.CloningFrameworkClassLoader.getInstance(CloningFrameworkClassLoader.java:222)
at oracle.as.clone.cloner.component.ComponentCreateCloner.doClone(ComponentCreateCloner.java:66)
at oracle.as.clone.cloner.Cloner.doFinalClone(Cloner.java:56)
at oracle.as.clone.request.CreateGenericArchive.doGenericArchive(CreateGenericArchive.java:128)
at oracle.as.clone.request.CreateCloneRequest._clone(CreateCloneRequest.java:69)
at oracle.as.clone.process.CloningExecutionProcess.execute(CloningExecutionProcess.java:145)
at oracle.as.clone.process.CloningExecutionProcess.execute(CloningExecutionProcess.java:128)
at oracle.as.clone.client.CloningClient.executeCloneCommand(CloningClient.java:123)
at oracle.as.clone.client.CloningClient.main(CloningClient.java:83)
oracle.as.clone.exception.FMWCloningException: java.lang.NullPointerException
at oracle.as.clone.classloader.CloningFrameworkClassLoader.getInstance(CloningFrameworkClassLoader.java:227)
at oracle.as.clone.cloner.component.ComponentCreateCloner.doClone(ComponentCreateCloner.java:66)
at oracle.as.clone.cloner.Cloner.doFinalClone(Cloner.java:56)
at oracle.as.clone.request.CreateGenericArchive.doGenericArchive(CreateGenericArchive.java:128)
at oracle.as.clone.request.CreateCloneRequest._clone(CreateCloneRequest.java:69)
at oracle.as.clone.process.CloningExecutionProcess.execute(CloningExecutionProcess.java:145)
at oracle.as.clone.process.CloningExecutionProcess.execute(CloningExecutionProcess.java:128)
at oracle.as.clone.client.CloningClient.executeCloneCommand(CloningClient.java:123)
at oracle.as.clone.client.CloningClient.main(CloningClient.java:84)
Caused by: java.lang.NullPointerException
=======================================================================================
Basically I am looking at knowing the difference between pack/unpack and T2P using copyConfig/copyBinary/extractMovePlan.
Thanks
Rathnam -
Difference between Unique key and Primary key(other than normal difference)
Hello,
1).Can any one tell me any other difference between Unique key and Primary key other than it having NULLs.
2). What is the difference the words 'DISTINCT' and 'UNIQUE' in a sql query.
Thanks in advance.Hi
If you don't believe me than see the documentation in
OTN.
Ott Karesz
http://www.trendo-kft.hu
SQL> create table scott.tbl_clob
2 (sss CLOB)
3 /
Tabelle wurde angelegt.
SQL> insert into scott.tbl_clob values('wrwrwrw')
2 /
1 Zeile wurde erstellt.
SQL> insert into scott.tbl_clob values('wrwrwrw')
2 /
1 Zeile wurde erstellt.
SQL> select distinct sss from scott.tbl_clob
2 /
select distinct sss from scott.tbl_clob
FEHLER in Zeile 1:
ORA-00932: nicht übereinstimmende Datentypen
SQL> select unique sss from scott.tbl_clob
2 /
select unique sss from scott.tbl_clob
FEHLER in Zeile 1:
ORA-00932: nicht übereinstimmende Datentypen
SQL> select distinct to_char(sss) from scott.tbl_clob
2 /
TO_CHAR(SSS)
wrwrwrw
SQL> select unique to_char(sss) from scott.tbl_clob
2 /
TO_CHAR(SSS)
wrwrwrw
SQL> -
Difference between Data staging and Dimension Table ?
Difference between Data staging and Dimension Table ?
Data Staging:
Data extraction and transformation is done here.
Meaning that, if we have source data in flat file, we extract it and load into staging tables, we take care of nulls, we change datetime format etc.. and after such cleansing/transformation at then end, load it to Dim/Fact tables
Pros: Makes process simpler and easy and also we can keep track of data as we have data in staging
Cons: Staging tables need space hence need memory space
Dimension Table:
tables which describes/stores the attribute about specific objects
Below is star schema which has dimension storing information related to Product, Customer etc..
-Vaibhav Chaudhari -
I want to know the difference between Days column and Day1 Column
Hi All,
I used this query:
SELECT to_char(return_date_time,'dd/mon/yyyy hh24:mi:ss') Test,
DECODE ('I', 'I', DECODE (1, NULL, NULL, 0, NULL, SYSDATE + 1)) Days,
DECODE ('I', 'I', SYSDATE + 1) Day1
FROM fm_curr_locn
WHERE patient_id = 'DU00002765'
output:
Test
Days
Day1
26/oct/2013 00:00:00
26-OCT-13
10/26/2013 3:06:59 PM
I want to know the difference between Days column and Day1 column and why the days column didnt show the time
Please anyone help.....
Regards
Shagar MPleiadian wrote:
It is the decode statement that is doing this.
The format of decode is:
decode(expression, search1, result1, search2, result2, searchn, resultn, default)
All result fields must be of the same datatype and will be of the datatype of the first result (result1 in this example)
In your example (the decode for the field Days) the first result is a NULL. I suspect (gurus? anyone?) that Oracle will use the varchar2 overload of the decode statement, and the date field will be converted to varchar2 using your NLS_DATE_FORMAT settings.
In the second decode statment (Day1) the first result is of datatype date, so the result of the decode statement will be a date field (and will be parsed as such by your sql development tool)
I agree, as NULL is the first result returned the datatype is undetermined, so Oracle is picking VARCHAR2 over others, and causing an implicit datatype conversion on the resultant date value, whereas the other which is returned as a date will use the local settings of the client tool being used.
I can replicate the 'issue' in Toad, and it's rectified if we cast the first returned value of the decode statement...
SELECT DECODE ('I', 'I', DECODE (1, NULL, CAST(NULL AS DATE), 0, NULL, SYSDATE + 1)) Days,
DECODE ('I', 'I', SYSDATE + 1) Day1
FROM dual -
Difference between wait event and timed event
Hi,
Anyone has idea that what is the difference between wait events and timed events in Statspack report. I couldn't find it over google.
Thanks.It's 10.2.0.1 on Linux
(Couldn't do a query, because Linux is inside VM Ware. And it is not being accessed from Base windows machine.)
Top 5 Timed Events Avg %Total
~~~~~~~~~~~~~~~~~~ wait Call
Event Waits Time (s) (ms) Time
db file scattered read 9,750,617 34,611 4 44.7
CPU time 14,248 18.4
read by other session 1,532,282 8,984 6 11.6
db file sequential read 4,514,494 5,588 1 7.2
latch: cache buffers lru chain 277,245 4,823 17 6.2
Wait Events DB/Inst: ABCD/ABCD Snaps: 1-2
-> s - second, cs - centisecond, ms - millisecond, us - microsecond
-> %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
-> Only events with Total Wait Time (s) >= .001 are shown
-> ordered by Total Wait Time desc, Waits desc (idle events last)
Avg
%Time Total Wait wait Waits
Event Waits -outs Time (s) (ms) /txn
db file scattered read 9,750,617 0 34,611 4 24.2
read by other session 1,532,282 0 8,984 6 3.8
db file sequential read 4,514,494 0 5,588 1 11.2
latch: cache buffers lru chain 277,245 0 4,823 17 0.7
latch free 121,466 0 3,291 27 0.3
---------------------------------------------------------------------------------------------------- -
Difference between inner join and outer join
1.Difference between inner join and outer join
2.wht is the difference in using hide and get crusor value in interactive.
3. Using join is better or views in writting program . Which is better.Table 1 Table 2
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
3
e2
f2
g2
h2
a3
b3
c3
2
4
e3
f3
g3
h3
a4
b4
c4
3
|--|||--|
Inner Join
|--||||||||--|
| A | B | C | D | D | E | F | G | H |
|--||||||||--|
| a1 | b1 | c1 | 1 | 1 | e1 | f1 | g1 | h1 |
| a2 | b2 | c2 | 1 | 1 | e1 | f1 | g1 | h1 |
| a4 | b4 | c4 | 3 | 3 | e2 | f2 | g2 | h2 |
|--||||||||--|
Example
Output a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
DATA: DATE LIKE SFLIGHT-FLDATE,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID.
SELECT FCARRID FCONNID F~FLDATE
INTO (CARRID, CONNID, DATE)
FROM SFLIGHT AS F INNER JOIN SPFLI AS P
ON FCARRID = PCARRID AND
FCONNID = PCONNID
WHERE P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '20010910' AND '20010920'
AND FSEATSOCC < FSEATSMAX.
WRITE: / DATE, CARRID, CONNID.
ENDSELECT.
If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or a table alias.
Note
In order to determine the result of a SELECT command where the FROM clause contains a join, the database system first creates a temporary table containing the lines that meet the ON condition. The WHERE condition is then applied to the temporary table. It does not matter in an inner join whether the condition is in the ON or WHEREclause. The following example returns the same solution as the previous one.
Example
Output of a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
DATA: DATE LIKE SFLIGHT-FLDATE,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID.
SELECT FCARRID FCONNID F~FLDATE
INTO (CARRID, CONNID, DATE)
FROM SFLIGHT AS F INNER JOIN SPFLI AS P
ON FCARRID = PCARRID
WHERE FCONNID = PCONNID
AND P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '20010910' AND '20010920'
AND FSEATSOCC < FSEATSMAX.
WRITE: / DATE, CARRID, CONNID.
ENDSELECT.
Note
Since not all of the database systems supported by SAP use the standard syntax for ON conditions, the syntax has been restricted. It only allows those joins that produce the same results on all of the supported database systems:
Only a table or view may appear to the right of the JOIN operator, not another join expression.
Only AND is possible in the ON condition as a logical operator.
Each comparison in the ON condition must contain a field from the right-hand table.
If an outer join occurs in the FROM clause, all the ON conditions must contain at least one "real" JOIN condition (a condition that contains a field from tabref1 amd a field from tabref2.
Note
In some cases, '*' may be specified in the SELECT clause, and an internal table or work area is entered into the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the FROM clause, according to the structure of each table work area. There can then be gaps between table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, not simply by counting the total number of fields. For an example, see below:
Variant 3
... FROM tabref1 LEFT [OUTER] JOIN tabref2 ON cond
Effect
Selects the data from the transparent database tables and/or views specified in tabref1 and tabref2. tabref1 und tabref2 both have either the same form as in variant 1 or are themselves join expressions. The keyword OUTER can be omitted. The database tables or views specified in tabref1 and tabref2 must be recognized by the ABAP-Dictionary.
In order to determine the result of a SELECT command where the FROM clause contains a left outer join, the database system creates a temporary table containing the lines that meet the ON condition. The remaining fields from the left-hand table (tabref1) are then added to this table, and their corresponding fields from the right-hand table are filled with ZERO values. The system then applies the WHERE condition to the table.
Left outer join between table 1 and table 2 where column D in both tables set the join condition:
Table 1 Table 2
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
3
e2
f2
g2
h2
a3
b3
c3
2
4
e3
f3
g3
h3
a4
b4
c4
3
|--|||--|
Left Outer Join
|--||||||||--|
| A | B | C | D | D | E | F | G | H |
|--||||||||--|
| a1 | b1 | c1 | 1 | 1 | e1 | f1 | g1 | h1 |
| a2 | b2 | c2 | 1 | 1 | e1 | f1 | g1 | h1 |
| a3 | b3 | c3 | 2 |NULL|NULL|NULL|NULL|NULL|
| a4 | b4 | c4 | 3 | 3 | e2 | f2 | g2 | h2 |
|--||||||||--|
Regards
Prabhu -
Difference between relational integrity and data intigrity
hi
could anybody tell me
what is the difference between
relational integrity and data intigrity
tahnx
kals.hi,
Data Integrity
Data integrity means, in part, that you can correctly and consistently navigate and manipulate the tables in the database. There are two basic rules to ensure data integrity; entity integrity and referential integrity.
The entity integrity rule states that the value of the primary key can never be a null value (a null value is one that has no value and is not the same as a blank). Because a primary key is used to identify a unique row in a relational table, its value must always be specified and should never be unknown. The integrity rule requires that insert, update, and delete operations maintain the uniqueness and existence of all primary keys.
The referential integrity rule states that if a relational table has a foreign key, then every value of the foreign key must either be null or match the values in the relational table in which that foreign key is a primary key.
What is a Relational Integrity?
A relational database contains tables of data which are related to each other. For example, articles are related to the author who wrote them, and conversely, authors are related to the articles they wrote. (Sounds obvious, and it is.) That's the relational part.
When we work with a relational database, we naturally expect that data in related tables stay related. For example, articles written by MartinB should always be related to MartinB and never be confused with articles written by any other author. That's the integrity part.
Relational Integrity is also called Referential Integrity, perhaps because the mechanism for ensuring integrity is implemented by the way the tables reference each other. Both terms are okay with me. I usually just say RI anyway.
Regards,
Sourabh -
Difference between the user_bytes and the bytes of dba_data_files
What's the difference between the user_bytes and the bytes column of the dba_data_file view?
Hi,
>>Bytes : Size Occupied
No. The size of the datafile. Doesn't matter free or used space.
>>User Bytes: Size available for Occupying.
No and Yes. Keep in mind that it shows the total size of the file available for user data since it was creation minus the related metadata information.
In resume, take a look at below:
You can see below, that datafile has 1,500 MB of size but it has 1,499.9375 MB available for user data.
LEGATTI@ORACLE10> select file_id,file_name,bytes,user_bytes from dba_data_files where tablespace_name='USERS2';
FILE_ID FILE_NAME BYTES USER_BYTES
7 /u02/oradata/DB01/user02.dbf 1572864000 1572798464
LEGATTI@ORACLE10> SELECT Substr(df.tablespace_name,1,20) "Tablespace Name",
2 Substr(df.file_name,1,40) "File Name",
3 Round(df.bytes/1024/1024,2) "Size (M)",
4 df.increment_by "Increment By",
5 Round(e.used_bytes/1024/1024,2) "Used (M)",
6 Round(f.free_bytes/1024/1024,2) "Free (M)"
7 FROM DBA_DATA_FILES DF,
8 (SELECT file_id,
9 Sum(Decode(bytes,NULL,0,bytes)) used_bytes
10 FROM dba_extents
11 GROUP by file_id) E,
12 (SELECT Max(bytes) free_bytes,
13 file_id
14 FROM dba_free_space
15 GROUP BY file_id) f
16 WHERE e.file_id (+) = df.file_id
17 AND df.file_id = f.file_id (+)
18 AND df.file_id = 7
19 ORDER BY df.tablespace_name,
20 df.file_name;
Now, you can see that just 874 MB has been used from 1,499.9375 MB real space available.
Tablespace Name File Name Size (M) Increment By Used (M) Free (M)
USERS2 /u02/oradata/DB01/user02.dbf 1,500 0 874.88 625,05Now, is that clear?
Cheers
Legatti
Maybe you are looking for
-
AX loses connection after being plugged into new modem
Our Internet connection had become real slow. (HN9000 Modem through HUGHES net satellite service). Our provider did some diagnostics and determined we needed a new modem and our satelitte was out of alignment. Hooked up the new modem. All was fine
-
HI ABAP Gurus, In selection screen i want to make selectoption/parameter field in displaymode( User cant change that field it shud appear but in display mode). Plz help me regarding this. I am using At selection-screen output for this as declaring Mo
-
Flagged photos in iPhoto not showing up in iMovie
I recently updated both imovie and iphoto. I have several flagged photos in iphoto. I am working in imovie to create a movie. When I cleck the camera on the lower right to import photos into imovie, I see all my photos. However, I don't see an op
-
BPM. parForEach block. deadline. multiline element
Hi all, I have BPM where block parForEach exist. In that block there is another block with send message step(application confirmation demand) and deadline with throw exception step. In parent block (parForEach) I catch this exception and add this ele
-
Deletion of commodity code in foreign trade of the material master
Hi, can we delete the commodity code in materials master data of the foreign trade tab? if so, how.