Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Oracle³£ÓÃÎÊÌâ½â´ð

 £¨1£©[Q]ÈçºÎ²åÈëµ¥ÒýºÅµ½Êý¾Ý¿â±íÖÐ
[A]¿ÉÒÔÓÃASCIIÂë´¦Àí£¬ÆäËüÌØÊâ×Ö·ûÈç&Ò²Ò»Ñù£¬Èç
insert into t values('i'||chr(39)||'m'); -- chr(39)´ú±í×Ö·û'
»òÕßÓÃÁ½¸öµ¥ÒýºÅ±íʾһ¸ö
or insert into t values('I''m'); -- Á½¸ö''¿ÉÒÔ±íʾһ¸ö'
 
£¨2£©[Q]Ëæ»ú³éÈ¡Ç°NÌõ¼Ç¼µÄÎÊÌâ
[A]8iÒÔÉÏ°æ±¾
select * from (select * from tablename order by dbms_random.value) where rownum< N;
×¢£ºdbms_random°üÐèÒªÊÖ¹¤°²×°£¬Î»ÓÚ$ORACLE_HOME/rdbms/admin/dbmsrand.sql
dbms_random.value(100,200)¿ÉÒÔ²úÉú100µ½200·¶Î§µÄËæ»úÊý
 
£¨3£©[Q]ÔõôÑù³éÈ¡Öظ´¼Ç¼
[A]select * from table t1 where t1.rowid !=
(select max(rowid) from table t2
where t1.id=t2.id and t1.name=t2.name)
»òÕß
select count(*), t.col_a,t.col_b from table t
group by col_a,col_b
having count(*)>1
Èç¹ûÏëɾ³ýÖظ´¼Ç¼£¬¿ÉÒ԰ѵÚÒ»¸öÓï¾äµÄselectÌ滻Ϊdelete
 
£¨4£©[Q]ÔõôÑùÉèÖÃ×ÔÖÎÊÂÎñ
[A]8iÒÔÉÏ°æ±¾£¬²»Ó°ÏìÖ÷ÊÂÎñ
pragma autonomous_transaction;
……
commit|rollback;
 
£¨5£©[Q]ÔõôÑùÔÚ¹ý³ÌÖÐÔÝÍ£Ö¸¶¨Ê±¼ä
[A]DBMS_LOCK°üµÄsleep¹ý³Ì
È磺dbms_lock.sleep(5);±íʾÔÝÍ£5Ãë¡£
 
£¨6£©[Q]ÔõÑù´´½¨ÁÙʱ±í
[A]8iÒÔÉÏ°æ±¾
create global temporary tablename(column list)
on commit preserve rows; --Ìá½»±£ÁôÊý¾Ý »á»°ÁÙʱ±í
on commit delete rows; --Ìύɾ³ýÊý¾Ý ÊÂÎñÁÙʱ±í
ÁÙʱ±íÊÇÏà¶ÔÓڻỰµÄ£¬±ðµÄ»á»°¿´²»µ½¸Ã»á»°µÄÊý¾Ý¡£
 
£¨7£©[Q]ÔõôÑùÔÚPL/SQLÖÐÖ´ÐÐDDLÓï¾ä
[A]1¡¢8iÒÔÏ°汾dbms_sql°ü
2¡¢8iÒÔÉÏ°æ±¾»¹¿ÉÒÔÓÃ
execute immediate sql;
dbms_utility.exec_ddl_statement('sql');
 
£¨8£©[Q]ÔõôÑù»ñÈ¡IPµØÖ·
[A]·þÎñÆ÷(817ÒÔÉÏ)£ºutl_inaddr.get_host_address
¿Í»§¶Ë£ºsys_context('userenv','ip_address')
 
£¨9£©[Q]ÔõôÑùÔÚORACLEÖж¨Ê±ÔËÐд洢¹ý³Ì
[A]¿ÉÒÔÀûÓÃdbms_job°üÀ´¶¨Ê±ÔËÐÐ×÷Òµ£¬ÈçÖ´Ðд洢¹ý³Ì£¬Ò»¸ö¼òµ¥µÄÀý×Ó£¬Ìá½»Ò»¸ö×÷Òµ£º
VARIABLE jobno number;
BEGIN
DBMS_JOB.SUBMIT(:jobno, 'ur_procedure;',SYSDATE,'SYSDATE + 1');
commit;
END;
Ö®ºó£¬¾Í¿ÉÒÔÓÃÒÔÏÂÓï¾ä²éѯÒѾ­Ìá½»µÄ×÷Òµ
select * from user_jobs;
 
£¨10£©[Q]ÔõôÑù´ÓÊý¾Ý¿âÖлñµÃ


Ïà¹ØÎĵµ£º

ÔÚOracle 9iÖÐÐ޸ıíµÄ½á¹¹µÄÏà¹ØsqlÓï¾ä

ÓÃsql*plus»òµÚÈý·½¿ÉÒÔÔËÐÐsqlÓï¾äµÄ³ÌÐòµÇ¼Êý¾Ý¿â£º
Ôö¼ÓÒ»¸öÁУº
ALTER TABLE ±íÃû ADD(ÁÐÃû Êý¾ÝÀàÐÍ);
È磺
ALTER TABLE emp ADD(weight NUMBER(38,0));
ÐÞ¸ÄÒ»¸öÁеÄÊý¾ÝÀàÐÍ(Ò»°ãÏÞÓÚÐ޸ij¤¶È£¬ÐÞ¸ÄΪһ¸ö²»Í¬ÀàÐÍʱÓÐÖî¶àÏÞÖÆ):
ALTER TABLE ±íÃû MODIFY(ÁÐÃû Êý¾ÝÀàÐÍ);
È磺
ALTER TABLE emp MODIFY(wei ......

oracle sql*plus set &spool½éÉÜ(¶þ)

Oracle spool Ó÷¨Ð¡½á[°ëת°ë¼Ó]
¹ØÓÚSPOOL(SPOOLÊÇSQLPLUSµÄÃüÁ²»ÊÇSQLÓï·¨ÀïÃæµÄ¶«Î÷¡£)
¶ÔÓÚSPOOLÊý¾ÝµÄSQL£¬×îºÃÒª×Ô¼º¶¨Òå¸ñʽ£¬ÒÔ·½±ã³ÌÐòÖ±½Óµ¼Èë,SQLÓï¾äÈ磺
select empno||','||ename||','||sal from emp;
spool³£ÓõÄÉèÖÃ
set colsep' ';¡¡¡¡¡¡ //ÓòÊä³ö·Ö¸ô·û
set echo off;¡¡¡¡¡¡¡¡//ÏÔʾstartÆô¶¯µ ......

oracle dba ³£ÓÃsql語¾ä

³£ÓÃSQL²éѯ£º
 
1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС
 
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
 
2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ¼°´óС
 
select t ......

oracleС¼Í

INSERT INTO hydlsrs@remote_£ú£úh
SELECT * from hydlsrs where zzh='2'
hydlsrsΪ±íÃû¡¡£Àremote_zzhΪ¿âÃû
select * from hydlsrsΪÁí1¿âÖбíÃû£¬
²»Í¬¿âÖÐÏàͬ±í½á¹¹£¬¿ÉÒÔ¿ç¿â²åÈë¡£ÓÃÓÚ
2µØµ¹Èë±íÄÚÈÝ¡£  ......

oracle ¼òµ¥µÄ×Ö·û´®²ð·Öº¯Êý

д´æ´¢¹ý³Ìʱ£¬Óõ½²ð·Ö×Ö·û´®£¬µÚÒ»¸ö´«Èë²ÎÊýΪ´ø·Ö¸î·ûµÄ×Ö·û´®£¬µÚ¶þ¸öΪ·Ö¸ô·ûµÄ¸öÊý£¬ÏÂÃæÊǵ¥Ìá³öÀ´µÄ·Ö¸î×Ö·û´®·½·¨£¬
create or replace procedure split(                      ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ