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

±±´óÇàÄñoracleѧϰ±Ê¼Ç4 5

sql plus ±£´æsqlÓï¾ä
save 'd:\sql.txt';½«oracle»º´æÇøÖеÄsqlÓï¾ä´æÈëÎļþ¡£
get 'd:\sql.txt';´ËʱsqlÓï¾ä±»¼ÓÔص½oracle»º´æÇø£¬Ê¹ÓÃrun;ÃüÁîÖ´ÐÐsqlÓï¾ä¡£
@'d:\sql.txt';¼ÓÔØsqlÓï¾ä²¢Ö±½ÓÖ´ÐС£
oracleÖеĺ¯Êý
 
1. ת»»º¯Êý
TO_CHAR(number[,format])
½«Ò»¸öÊýֵת»»³ÉÓëÖ®µÈ¼ÛµÄ×Ö·û´®.Èç¹û²»Ö¸¶¨¸ñʽ,½«×ª»»³É×î¼òµ¥µÄ×Ö·û´®ÐÎʽ.Èç¹ûΪ¸ºÊý¾ÍÔÚÇ°Ãæ¼ÓÒ»¸ö¼õºÅ.
TO_CHAR(date[,format])
½«°´format²ÎÊýÖ¸¶¨µÄ¸ñʽ½«ÈÕÆÚֵת»»³ÉÏàÓ¦µÄ×Ö·û´®ÐÎʽ.ͬÑù,OracleÌṩÐí¶àµÄ¸ñʽģÐÍ,Óû§¿ÉÒÔÓÃËüÃǵÄ×éºÏÀ´±íʾ×îÖÕµÄÊä³ö¸ñʽ.ΨһÏÞÖƾÍÊÇ×îÖÕµÄÑÚÂë²»Äܳ¬¹ý22¸ö×Ö·û.ϱíÁгöÁ˲¿·ÖÈÕÆÚ¸ñʽ»¯ÔªËØ.
 
 TO_DATE(string,format)
¸ù¾Ý¸ø¶¨µÄ¸ñʽ½«Ò»¸ö×Ö·û´®×ª»»³ÉOracleµÄÈÕÆÚÖµ.
¸Ãº¯ÊýµÄÖ÷ÒªÓÃ;ÊÇÓÃÀ´ÑéÖ¤ÊäÈëµÄÈÕÆÚÖµ.ÔÚÓ¦ÓóÌÐòÖÐ,Óû§±ØÐëÑéÖ¤ÊäÈëÈÕÆÚÊÇ·ñÓÐЧ,ÈçÔ·ÝÊÇ·ñÔÚ1~12Ö®¼äºÍÈÕÆÚÖеÄÌìÊýÊÇ·ñÔÚÖ¸¶¨Ô·ݵÄÌìÊýÄÚ.
 
TO_NUMBER(string[,format])
¸Ãº¯Êý½«Ò»¸ö×Ö·û´®×ª»»³ÉÏàÓ¦µÄÊýÖµ.¶ÔÓÚ¼òµ¥µÄ×Ö·û´®×ª»»ÊýÖµ(ÀýÈ缸λÊý×Ö¼ÓÉÏСÊýµã).¸ñʽÊÇ¿ÉÑ¡µÄ.
 
2. ÈÕÆÚº¯Êý
 
ADD_MONTHS(date,number)
ÔÚÈÕÆÚdateÉϼÓÖ¸¶¨µÄÔÂÊý,·µ»ØÒ»¸öÐÂÈÕÆÚ.Èç¹û¸ø¶¨Îª¸ºÊý,·µ»ØֵΪÈÕÆÚdate֮ǰ¼¸¸öÔµÄÈÕÆÚ.numberÓ¦µ±ÊǸöÕûÊý,Èç¹ûÊÇСÊý,ÕýÊý±»½ØΪСÓÚ¸ÃÊýµÄ×î´óÕûÊý,¸ºÊý±»½ØΪ´óÓÚ¸ÃÊýµÄ×îСÕûÊý.
 
 LAST_DAY(date)
·µ»ØÈÕÆÚdateËùÔÚÔ·ݵÄ×îºóÒ»ÌìµÄÈÕÆÚ.
 
 MONTHS_BETWEEN(date1,date2)
·µ»ØÁ½¸öÈÕÆÚÖ®¼äµÄÔ·Ý.Èç¹ûÁ½¸öÈÕÆÚÔ·ÝÄÚµÄÌìÊýÏàͬ(»òÕ߶¼ÊÇij¸öÔµÄ×îºóÒ»Ìì),·µ»ØÖµÊÇÕûÊý.·ñÔò,·µ»ØÖµÊÇСÊý,ÿÓÚ1/31ÔÂÀ´¼ÆËãÔÂÖÐÊ£ÓàÌìÊý.Èç¹ûµÚ¶þ¸öÈÕÆڱȵÚÒ»¸öÈÕÆÚ»¹Ôç,Ôò·µ»ØÖµÊǸºÊý.
 
NEXT_DAY(date,day)
¸Ãº¯Êý·µ»ØÈÕÆÚdateÖ¸¶¨ÈôÌìºóµÄÈÕÆÚ.×¢Òâ:²ÎÊýday±ØÐëΪÐÇÆÚ,¿ÉÒÔÐÇÆÚ¼¸µÄÓ¢ÎÄÍêÕûƴд,»òÇ°Èý¸ö×ÖĸËõд,»òÊý×Ö1,2,3,4,5,6,7·Ö±ð±íʾÐÇÆÚÈÕµ½ÐÇÆÚÁù.ÀýÈç,²éѯ·µ»Ø±¾ÔÂ×îºóÒ»¸öÐÇÆÚÎåµÄÈÕÆÚ.
 
 
ROUND (date[,format])
¸Ãº¯Êý°ÑÒ»¸öÈÕÆÚËÄÉáÎåÈëµ½×î½Ó½ü¸ñʽԪËØÖ¸¶¨µÄÐÎʽ.Èç¹ûÊ¡ÂÔformat,Ö»·µ»ØdateµÄÈÕÆÚ²¿·Ö.ÀýÈç,Èç¹ûÏë°Ñʱ¼ä(24/01/00 14:58:41)ËÄÉáÎåÈëµ½×î½üµÄСʱ.ϱíÏÔʾÁËËùÓпÉÓøñʽԪËضÔÈÕÆÚµÄÓ°Ïì.
TRUNC(date[,format])
TRUNCº¯ÊýÓëROUNDºÜÏàËÆ,Ëü¸ù¾ÝÖ¸¶¨µÄ¸ñʽÑÚÂëÔªËØ,Ö»·µ»ØÊäÈëÈÕÆÚÓû§Ë


Ïà¹ØÎĵµ£º

oracle´æ´¢¹ý³Ì´úÂëʵÀý

1¡¢ÓÃÀ´²åÈë´óÁ¿²âÊÔÊý¾ÝµÄ´æ´¢¹ý³Ì
CREATE OR REPLACE PROCEDURE INSERTAMOUNTTEST
(
ST_NUM        IN     NUMBER,
ED_NUM        IN     NUMBER
)
IS
BEGIN
declare
     ......

Àí½âOracle×Ö·û¼¯ÎÊÌâ

Ò»£®ÒýÑÔ
    ORACLEÊý¾Ý¿â×Ö·û¼¯£¬¼´OracleÈ«Çò»¯Ö§³Ö(Globalization Support)£¬»ò¼´¹ú¼ÒÓïÑÔÖ§³Ö£¨NLS£©Æä×÷ÓÃÊÇÓñ¾¹úÓïÑԺ͸ñʽÀ´´æ´¢¡¢´¦ÀíºÍ¼ìË÷Êý¾Ý¡£ÀûÓÃÈ«Çò»¯Ö§³Ö£¬ORACLEΪÓû§Ìṩ×Ô¼ºÊìϤµÄÊý¾Ý¿âĸÓï»·¾³£¬ÖîÈçÈÕÆÚ¸ñʽ¡¢Êý×Ö¸ñʽºÍ´æ´¢ÐòÁеȡ£Oracle¿ÉÒÔÖ§³Ö¶àÖÖÓïÑÔ¼°×Ö·û¼¯£¬ÆäÖÐoracle8 ......

½«Êý¾Ý¿âµÄSQL½Å±¾Îļþµ¼Èëµ½oracleÖÐ

#1. Ê×ÏÈÒÔ¹ÜÀíÔ±µÄÉí·ÝµÇ¼µ½oracleϵͳÖÐ
cmd;
sqlplus sys/sys as sysdba;
#2.´´½¨Óû§test,ÃÜÂëΪtest
create user test identified by test;
#3.´´½¨±í¿Õ¼ä,ÔÚDÅÌϽ¨Á¢50mµÄ±í¿Õ¼ädata_dbf
create tablespace ts_tablespace datefile 'D:\data_dbf' size 50m;
#4.ΪÓû§·ÖÅä±í¿Õ¼ä
alter user test default t ......

OracleÁÙʱ±í ÓÅ»¯²éѯËÙ¶È

OracleÁÙʱ±í ÓÅ»¯²éѯËÙ¶È
1¡¢Ç°ÑÔ
    Ä¿Ç°ËùÓÐʹÓÃOracle×÷ΪÊý¾Ý¿âÖ§³Åƽ̨µÄÓ¦Ó㬴󲿷ÖÊý¾ÝÁ¿±È½ÏÅÓ´óµÄϵͳ£¬¼´±íµÄÊý¾ÝÁ¿Ò»°ãÇé¿ö϶¼ÊÇÔÚ°ÙÍò¼¶ÒÔÉϵÄÊý¾ÝÁ¿¡£
    µ±È»ÔÚOracleÖд´½¨·ÖÇøÊÇÒ»ÖÖ²»´íµÄÑ¡Ôñ£¬µ«Êǵ±Äã·¢ÏÖÄãµÄÓ¦ÓÃÓжàÕűí¹ØÁªµÄʱºò£¬²¢ÇÒÕâЩ±í´ó²¿·Ö¶¼ÊÇ±È½Ï ......

oracleѧϰ±Ê¼Ç——ÊÓͼ


1.ÊÓͼ£¨VIEW£©
1.1 ¸ÅÄî
       ÊÓͼ-----ÊÇÓÉSELECT²éѯÓï¾ä(¿ÉÒÔÊǵ¥±í»òÕ߶à±í²éѯ)¶¨ÒåµÄÒ»¸ö"Âß¼­±í",Ö»Óж¨Òå¶øÎÞÊý¾Ý,ÊÇÒ»¸ö"Ðé±í". ÔÚ´´½¨ÊÓͼʱ,Ö»Êǽ«ÊÓͼµÄ¶¨ÒåÐÅÏ¢±£´æÔÚÊý¾Ý×ÖµäÖÐ, ¶ø²¢²»½«Êµ¼ÊµÄÊý¾Ý¸´ÖƵ½Èκεط½, ¼´²»ÐèÒªÔÚ±í¿Õ¼äÖÐΪÊÓͼ·ÖÅä´æ´¢¿Õ¼ä. ÊÓͼÊDz鿴º ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ