?
oracle程序包的原理和使用(三)
s length request
-- so the number of bytes returned will be 256 or less if a line terminator is seen.
F1 := UTL_FILE.FOPEN( 'MYDIR', 'MYFILE', 'R', 256);
UTL_FILE.GET_LINE (F1 ,V1 ,32767 );
UTL_FILE.FCLOSE (F1 );
-- In this example, FOPEN's MAX_LINESIZE is NULL and defaults to 1024,
-- so the number of bytes returned will be 1024 or less if a line terminator is seen.
F1 := UTL_FILE.FOPEN( 'MYDIR', 'MYFILE', 'R');
UTL_FILE.GET_LINE (F1 ,V1 ,32767 );
UTL_FILE.FCLOSE (F1 );
-- In this example, GET_LINE doesn't specify a number of bytes, so it defaults to
-- the same value as FOPEN's MAX_LINESIZE which is NULL in this case and defaults to 1024.
-- So the number of bytes returned will be 1024 or less if a line terminator is seen.
F1 := UTL_FILE.FOPEN( 'MYDIR', 'MYFILE', 'R');
UTL_FILE.GET_LINE (F1 ,V1 );
UTL_FILE.FCLOSE (F1 );
END ;
PL /SQL procedure successfully completed
SQL >
dbms_random的使用:
返回某年内的随机日期,分两步:
1, SELECT TO_CHAR( TO_DATE( '01/01/03', 'mm/dd/yy'), 'J') FROM DUAL;
2, SELECT TO_DATE( TRUNC( DBMS_RANDOM.VALUE( 2452641, 2452641+ 364)), 'J') FROM DUAL ;