I'm trying to format a TIMESTAMP with 6 digits of the fractional part. 'FF' seems to print all available dig开发者_StackOverflow社区its, even if I explicitly declare a TIMESTAMP(6):
DECLARE
t TIMESTAMP(6);
BEGIN
t := SYSTIMESTAMP;
dbms_output.put_line( TO_CHAR(t, 'FF') );
END;
prints
912387000
Is there a way to get
912387
instead (without using SUBSTRING or something similar)?Yes that's possible, by using 'FF6':
SQL> DECLARE
2 t TIMESTAMP(6);
3 BEGIN
4 t := SYSTIMESTAMP;
5 dbms_output.put_line( TO_CHAR(t, 'FF') );
6 dbms_output.put_line( TO_CHAR(t, 'FF6') );
7 END;
8 /
234771000
234771
PL/SQL procedure successfully completed.
Here is the link to the documentation: http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements004.htm#r16c1-t64
Regards, Rob.
加载中,请稍侯......
精彩评论