View previous topic :: View next topic
|
Author |
Message |
vickyprodigy
New User
Joined: 18 Jul 2007 Posts: 11 Location: Chennai
|
|
|
|
Hi,
I generate reports from Error log tables. Wat i do is... i run a SELECT query based on certain conditions and i FTP the result in a TXT format. When i FTP it, the records which has NULL in the table is getting overwritten by the values of the subsequent column. To prevent this, i need a way to substitute someother value (eg '-' ) for the NULL values. Is it possible to do it in the SELECT query itself???? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
COALESCE |
|
Back to top |
|
|
vickyprodigy
New User
Joined: 18 Jul 2007 Posts: 11 Location: Chennai
|
|
|
|
Can you explain please |
|
Back to top |
|
|
vickyprodigy
New User
Joined: 18 Jul 2007 Posts: 11 Location: Chennai
|
|
|
|
thanks got it...
also...
can somebody tell ... how do i make the result of a varchar column of same length in a SELECT query...
Thanks |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
Or use 'SELECT VALUE(COLX,value)'
Whenever COLX column has null, it is substituted by value. |
|
Back to top |
|
|
mbr_raja
New User
Joined: 15 Nov 2004 Posts: 26 Location: Chennai, India
|
|
|
|
Hi,
You can use this function as given below. By using the IFNULL function, you can able to findout null values and replace with given specific strings. It can also be used to specify multiple columns within a single select query.
SELECT EMPNO, IFNULL(SALARY, '-') FROM ADMINISTRATOR.EMP; |
|
Back to top |
|
|
|