Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank values in SQL statement

Status
Not open for further replies.

Mojster

Programmer
Sep 26, 2001
18
SI
This works OK:

SELECT A.Num-A.Num2
FROM "Test.DB" A, "test2.DB" B


But why this SQL statement return as resault NULL if Num (or Num2) is blank? What is the solution of this problem?

SELECT A.Num-A.Num2
FROM "Test.DB" A, "test2.DB" B
WHERE A.X=B.X
 
If num and num2 are integers, a blank is probably a null. Using null in an expression always yields null. If you want a "blank" (null) to act like zero, you can try this . . .

SELECT NVL(A.Num,0)-NVL(A.Num2,0)
FROM "Test.DB" A, "test2.DB" B
WHERE A.X=B.X
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top