Thread: RETURN VALUES ON INTEGERS
I have the following DATABASE. CREATE TABLE codestatus (id int primary key,code int,status char ); code is an int number made at least of 6 numbers. (range from 0 up to 999999) If i do : select * from codestatus; I GET: id|code|status --+------+------1| 44111|N 2| 123|S BUT I WOULD LIKE TO GET id|code|status --+------+------1|044111|N 2|000123|S How could I fix the prbolem and get the values as I ned them out of the select ? thanks in advance Alex
At 15:24 +0300 on 07/07/1999, Alessandro Rossi wrote: > I GET: > > id|code|status > --+------+------ > 1| 44111|N > 2| 123|S > > BUT I WOULD LIKE TO GET > > id|code|status > --+------+------ > 1|044111|N > 2|000123|S > > How could I fix the prbolem and get the values as I ned them out of the > select ? Try lpad. For example: testing=> select num, lpad( num, 6, '0' ) from test1; num| lpad ------+------ 2|000002 4|000004 38|000038 199|000199 100399|100399 (5 rows) Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma
> I have the following DATABASE. > > CREATE TABLE codestatus ( > id int primary key, > code int, > status char > ); > > code is an int number made at least of 6 numbers. > (range from 0 up to 999999) > > If i do : > > select * from codestatus; > > I GET: > > id|code|status > --+------+------ > 1| 44111|N > 2| 123|S > > BUT I WOULD LIKE TO GET > > id|code|status > --+------+------ > 1|044111|N > 2|000123|S > > How could I fix the prbolem and get the values as I ned them > out of the > select ? > > thanks in advance > > Alex > Try select id, lpad(code, 6, '0'), status from codestatus John