ORACLE directory Ŀ¼
Create directoryÈÃÎÒÃÇ¿ÉÒÔÔÚOracleÊý¾Ý¿âÖÐÁé»îµÄ¶ÔÎļþ½øÐжÁд²Ù×÷£¬¼«´óµÄÌá¸ßÁËOracleµÄÒ×ÓÃÐԺͿÉÀ©Õ¹ÐÔ¡£
ÆäÓ﷨Ϊ:
CREATE [OR REPLACE] DIRECTORY directory AS 'pathname';
±¾°¸Àý¾ßÌå´´½¨ÈçÏÂ:
create or replace directory exp_dir as '/tmp';
Ŀ¼´´½¨ÒԺ󣬾ͿÉÒ԰ѶÁдȨÏÞÊÚÓèÌض¨Óû§£¬¾ßÌåÓï·¨ÈçÏÂ:
GRANT READ[,WRITE] ON DIRECTORY directory TO username;
ÀýÈç:
grant read, write on directory exp_dir to eygle;
´ËʱÓû§eygle¾ÍÓµÓÐÁ˶ԸÃĿ¼µÄ¶ÁдȨÏÞ¡£
ÈÃÎÒÃÇ¿´Ò»¸ö¼òµ¥µÄ²âÊÔ:
SQL> create or replace directory UTL_FILE_DIR as '/opt/oracle/utl_file';
Directory created.
SQL> declare
2 fhandle utl_file.file_type;
3 begin
4 fhandle := utl_file.fopen('UTL_FILE_DIR', 'example.txt', 'w');
5 utl_file.put_line(fhandle , 'eygle test write one');
6 utl_file.put_line(fhandle , 'eygle test write two');
7 utl_file.fclose(fhandle);
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> !
[oracle@jumper 9.2.0]$ more /opt/oracle/utl_file/example.txt
eygle test write one
eygle test write two
[oracle@jumper 9.2.0]$
ÀàËƵÄÎÒÃÇ¿ÉÒÔͨ¹ýutl_fileÀ´¶ÁÈ¡Îļþ:
SQL> declare
2 fhandle utl_file.file_type;
3 fp_buffer varchar2(4000);
4 begin
5 fhandle := utl_file.fopen ('UTL_FILE_DIR','example.txt', 'R');
6
7 utl_file.get_line (fhandle , fp_buffer );
8 dbms_output.put_line(fp_buffer );
9 utl_file.get_line (fhandle , fp_buffer );
10 dbms_output.put_line(fp_buffer );
11 utl_file.fclose(fhandle);
12 end;
13 /
eygle test write one
eygle test write two
PL/SQL procedure successfully completed.
Ïà¹ØÎĵµ£º
Ϊ·ÀÍü¼Ç£¬¼Ç¼ÓÚÏ£º
oracle 11gR2 : http://www.oracle.com/pls/db112/homepage£¬ÏÂÔØÍøÖ·http://www.oracle.com/technology/documentation/database.html
oracle 11gR1 : http://www.oracle.com/pls/db111/homepage
oracle 10gR2 : http://www.oracle.com/pls/db102/homepage ......
ÓÃÃüÁîÐÐ(CMD)ÖÐÆô¶¯ºÍ¹Ø±ÕORACLE·þÎñ
¼àÌýÆô¶¯
lsnrctl start
¼àÌýÍ£Ö¹
lsnrctl stop
Æô¶¯Oracle
net start oracleservicesid
Í£Ö¹Oracle
net stop oracleservicesid
netÃüÁîÊÇwinϵͳÃüÁÆäËüµÄ·þÎñÆô¶¯ºÍÉÏÃæµÄÀàËÆ£¡
......
1
2
3
×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7
½¨Á¢±í¿Õ¼ä
8
9
CREATE TABLESPACE data01
10
DATAFILE '/oracle/oradata/d ......
select custid,carid,Cunote,INVNO,BUYPLAN
from ( select custid,carid,Cunote,INVNO,BUYPLAN,
row_number() over(partition by custid,carid order by Feedbackid desc) rn
from pvE3S.T_VCTM_CUSTOMER_FEEDBACK) t1 where rn=1
°´Feedbackid ÅÅÐò,rnÊÇÇ°NÐÐ ......
t±íÖн«½üÓÐ1100ÍòÊý¾Ý£¬ºÜ¶àʱºò£¬ÎÒÃÇÒª½øÐÐ×Ö·û´®Æ¥Å䣬ÔÚSQLÓï¾äÖУ¬ÎÒÃÇͨ³£Ê¹ÓÃlikeÀ´´ïµ½ÎÒÃÇËÑË÷µÄÄ¿±ê¡£µ«¾¹ýʵ¼Ê²âÊÔ·¢ÏÖ£¬likeµÄЧÂÊÓëinstrº¯Êý²î±ðÏ൱´ó¡£ÏÂÃæÊÇһЩ²âÊÔ½á¹û£º
SQL> set timing on
SQL> select count(*) from t where instr(title,’ÊÖ²á’)>0;
COUNT(*)
—&md ......