Sep 3, 2004 #1 MSIsam Programmer Sep 29, 2003 173 US I am new to ORACLE syntax and need the SQL code to convert zero to NULL. I am used to Teradata that has a NULLIFZERO function. Any help would be much appreciated, Sam
I am new to ORACLE syntax and need the SQL code to convert zero to NULL. I am used to Teradata that has a NULLIFZERO function. Any help would be much appreciated, Sam
Sep 3, 2004 #2 johnherman MIS Oct 10, 2003 2,323 US Here's an example which may help SELECT Keyfield, CASE numberfield WHEN 0 THEN NULL ELSE numberfield END FROM tablename ------------------------- The trouble with doing something right the first time is that noboby appreciates how difficult it was. - Steven Wright Upvote 0 Downvote
Here's an example which may help SELECT Keyfield, CASE numberfield WHEN 0 THEN NULL ELSE numberfield END FROM tablename ------------------------- The trouble with doing something right the first time is that noboby appreciates how difficult it was. - Steven Wright
Sep 3, 2004 #3 SantaMufasa Technical User Jul 17, 2003 12,588 US Sam, Here is a tighter code alternative to John's fine suggestion: Code: SELECT KeyField, decode(numberfield,0,null,numberfield) FROM tablename; Mufasa (aka Dave of Sandy, Utah, USA @ 16:37 (03Sep04) UTC (aka "GMT" and "Zulu"), 09:37 (03Sep04) Mountain Time) Upvote 0 Downvote
Sam, Here is a tighter code alternative to John's fine suggestion: Code: SELECT KeyField, decode(numberfield,0,null,numberfield) FROM tablename; Mufasa (aka Dave of Sandy, Utah, USA @ 16:37 (03Sep04) UTC (aka "GMT" and "Zulu"), 09:37 (03Sep04) Mountain Time)