Home » RDBMS Server » Server Administration » Oracle Number data type
Oracle Number data type [message #372208] Thu, 18 January 2001 17:12 Go to next message
Tam
Messages: 6
Registered: January 2001
Junior Member
I'm querying from Oracled db and one of my table have a field with a data type with size 38, Number(38). When i display the recordset from the query in a grid control on an ASP page, it also displays the leading 0's (38 times) up to the number. How do i go about deleting this?? Is this normal in Oracle? It displays the right number if i do:

checkfield = recSet.fields("mgcplog_id")
msgbox checkfield

Please help!!!
Re: Oracle Number data type [message #372214 is a reply to message #372208] Fri, 19 January 2001 00:25 Go to previous messageGo to next message
SQL_Tuner
Messages: 8
Registered: November 2000
Junior Member
I don't know ASP, so maybe this won't help but....

number(38) is the default size on many systems if you don't specify the length of a number column. If it can be smaller, you can change the definition of the column as

alter table <tabname> modify <col_nam> number (n);

The column may have to be empty to do this, so you might need to store the data elsewhere temporarily. By redefining it, you won't get 38 0's (tho you might get some).

Can you include an Oracle function in your ASP call? If so, use the to_char function:

select to_char ('X', '990') from
;

This turns the number into a character string whose format you manage with the mask '990'.

In Oracle, if you selected this number by itself, it would not have 38 leading zeroes by default. Default, would be 10 characters long, and no leading zeroes. Spaces would be padded on the left to make 10 characters.

Regards,
ST
Re: Oracle Number data type [message #372240 is a reply to message #372208] Mon, 22 January 2001 04:48 Go to previous message
Balazs VISSY
Messages: 17
Registered: January 2001
Junior Member
I agree with ST, the 38 is usually the default size of the number field.

If you would like to reduce the zeroes without modifying the scheme, there is another way to do:

LTRIM(TO_CHAR(X),'0')

Balage
Previous Topic: Database Creation from the client ?
Next Topic: Deleting duplicate rows
Goto Forum:
  


Current Time: Mon Dec 23 01:03:09 CST 2024