Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将以下内容放在我的 SQL 选择语句中,以将文本字符串(不是数据库中的字段)与几个数据库字段连接起来,并且我得到了空格,我尝试使用 to_char 函数将前导零添加到一对字段。
运行:SELECT 'EP.'||TO_CHAR(PWROTPR_TRANSX_NBR,'0000000')||'.'||TO_CHAR(PWROTPR_SUBMIT_COUNTER,'00') as ATS_NBR
产量:EP。0017092.01
如何消除不必要的空格?
尝试使用替换功能:
SELECT replace(('EP.'||TO_CHAR(PWROTPR_TRANSX_NBR,'0000000')||'.'||TO_CHAR(PWROTPR_SUBMIT_COUNTER,'00')), ' ', '') as ATS_NBR