下例使用 LTRIM 字符删除字符变量中的起始空格。DECLARE @string_to_trim varchar(60) SET @string_to_trim = ' Five spaces are at the beginning of this string.' SELECT 'Here is the string without the leading spaces: ' + LTRIM(@string_to_trim) GO下面是结果集:------------------------------------------------------------------------ Here is the string without the leading spaces: Five spaces are at the beginning of this string. (1 row(s) affected)
我对ORACLE的函数不了解,谢谢你了.
select to_char(field1,999)¦¦' '¦¦field2 as MyField from table1;
15:57:14 SQL> select 1.23||' '||'abc' from dual;1.23||''|
---------
1.23 abc已用时间: 00: 00: 00.32
16:14:55 SQL> select to_char(123.456)||' '||'abc' from dual;TO_CHAR(123.
------------
123.456 abc已用时间: 00: 00: 00.16
16:15:12 SQL>
------------
123已用时间: 00: 00: 00.15
16:26:48 SQL> select trim(' aaa ') from dual;TRI
---
aaa已用时间: 00: 00: 00.31
16:27:00 SQL>
oracle中是to_char()
下面的示例将 123.45 的浮点表达式转换为字符长度为 6 和小数位数为 2 的字符。 SELECT STR(123.45, 6, 2)下面是结果集:------
123.45
SET @string_to_trim = ' Five spaces are at the beginning of this
string.'
SELECT 'Here is the string without the leading spaces: ' +
LTRIM(@string_to_trim)
GO下面是结果集:------------------------------------------------------------------------
Here is the string without the leading spaces: Five spaces are at the beginning of this string. (1 row(s) affected)
--------
123.46已用时间: 00: 00: 00.32
16:32:06 SQL>
--------
123.46已用时间: 00: 00: 00.32
16:32:06 SQL>
http://community.csdn.net/Expert/topic/3402/3402545.xml?temp=.1959345
此得分啦.