简体   繁体   中英

Removing leading zeroes in a select* SQL

I want to strip the leading zeroes in certain columns of my select statement. I know how to do this if the column names are listed:

For example, in SELECT a,b,c.... if I want to trim column b, I simply do

SELECT a, TRIM(LEADING '0' FROM b) new name, c.... 

Now I also want to do the same for a SELECT* statement.. Suppose I have SELECT *, and I want to trim the leading zeroes for column b only. Is there an alternative to go as to convert the SELECT * to a normal select by listing out all columns? It becomes tedious this way.

This has been answered here: Removing leading zeros from varchar sql developer

select ltrim('000012345', '0') from dual;

LTRIM
-----
12345

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM