select rpad(|IFNULL(|null, ''),5,'1');

|/||/|
[EMAIL PROTECTED] ha scritto:
I am running a basic install of MySQL 5.0 with "strict mode" turned on I would like to use RPAD however at times a NULL var will be sent to the function. My goal is to have a function that will convert the NULL to a blank string to get the result of EXAMPLE3 if a NULL is returned.


EXAMPLE 1

mysql> select rpad(null,5,'1');
+------------------+
| rpad(null,5,'1') |
+------------------+
| NULL             |
+------------------+
1 row in set (0.00 sec)

EXAMPLE 2
mysql> select rpad('0',5,'1');
+-----------------+
| rpad('0',5,'1') |
+-----------------+
| 01111           |
+-----------------+
1 row in set (0.00 sec)

mysql>

EXAMPLE 3

mysql> select rpad('',5,'1');
+----------------+
| rpad('',5,'1') |
+----------------+
| 11111          |
+----------------+
1 row in set (0.02 sec)


Is there a function I can use to convert the null string to a blank string before it is sent to RPAD in a basic installation of MySQL or will I need to create a function?


Wishing you the best you know you deserve,

______________________
Lucas Heuman
CM Web Developer
SRA International, Inc.
FAA, WJHTC/Bldg 300, 2nd Fl., H33
Atlantic City Int'l Airport, NJ  08405
Phone 609.485.5401


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to