¡¾×ª¡¿ORACLE BLOB BFILE ÎļþµÄ¼Èë¼°¶ÁÈ¡
Èç¹ûÄã½Ó´¥¹ýmysqlµÄ»°Ò»¶¨¶ÔmysqlµÄtextºÍblob²»»áÄ°Éú£¬ÔÚmysqlÖÐÊÇÖ±½Ó²Ù×÷textºÍblobµÄ¡£µ«ÊÇÔÚoracleÖУ¬Ëü°Ñlob×öΪһÖÖÌØÊâµÄ×ֶΣ¬²»ÄÜÖ±½Ó½øÐвÙ×÷--±ÈÈç²»ÄÜÖ±½Ó²åÈëµ½lob×Ö¶ÎÖУ¬Ò²²»ÄÜÓÃlike²éѯµÈµÈ¡£
ÕâÀïÊÇÎÒ±£´æµÄһƪÕâ·½ÃæµÄÎÄÕ£¬ÔÎÄ°á¹ýÀ´£¬ÓÉÓÚ±£´æµÄʱºòÖ»ÊÇÈ¡ÁËÒ»²¿·Ö£¬Ã»Í·Ã»Î²µÄ£¬ËùÒÔû·¨ÕÒµ½ÔÀ´µÄ³ö´¦¡£
²»ÄÜÖ±½ÓÓÃINSERTÓï¾äÏòLOB×Ö¶ÎÖвåÈëÖµ¡£Ò»°ãÇé¿öÏ£¬ÓÐÈçϵļ¸²½£º
1 ÏÈ·ÖÎöÒ»¸öINSERTÓï¾ä£¬·µ»ØÒ»¸öLOBµÄÃèÊö·û
2 ÓÃOCIº¯ÊýÉú³ÉÒ»¸ö±¾µØµÄLOB¶ÔÏó
3 ½«LOB¶ÔÏó°ó¶¨µ½LOBÃèÊö·ûÉÏ
4 Ö´ÐÐINSERTÓï¾ä
5 ¸øLOB¶ÔÏó¸³Öµ
6 ÊÍ·ÅLOB¶ÔÏóºÍSQLÓï¾ä¾ä±ú
ÏÂÃæµÄÕâ¸öÀý×ÓÊÇ°ÑÓû§ÉÏ´«µÄͼƬÎļþ´æ·Åµ½BLOB£¨»òBFILEÖУ¬²Ù×÷ÉÔÓв»Í¬£©ÖС£
Ê×ÏÈÒª½¨Ò»¸ö±í£¬½á¹¹ÈçÏ£º
CREATE TABLE PICTURES (
ID NUMBER,
DESCRIPTION VARCHAR2(100),
MIME VARCHAR2(128),
PICTURE BLOB
);
Èç¹ûҪʵÏÖIDµÄ×Ô¶¯Ôö¼Ó£¬ÔÙ½¨Ò»¸öSEQUENCE:
CREATE SEQUENCE PIC_SEQ;
È»ºóÊÇÓÃÀ´´¦ÀíÊý¾ÝµÄPHP³ÌÐò´úÂë¡£
<?php
//½¨Á¢OracleÊý¾Ý¿âÁ¬½Ó
$conn = OCILogon($user, $password, $SID);
//Ìá½»SQLÓï¾ä¸øOracle
//ÔÚÕâÀïҪעÒâµÄÁ½µã£ºÒ»ÊÇÓÃEMPTY_BLOB()º¯Êý¡£ÕâÊÇOracleµÄÄÚ²¿º¯Êý£¬·µ»ØÒ»¸öLOBµÄ¶¨Î»·û¡£ÔÚ²åÈëLOBʱ£¬Ö»ÄÜÓÃÕâ¸ö°ì·¨ÏÈÉú³ÉÒ»¸ö¿ÕµÄLOB¶¨Î»·û£¬È»ºó¶ÔÕâ¸ö¶¨Î»·û½øÐвÙ×÷¡£EMPTY_BLOB()º¯ÊýÊÇÕë¶ÔBLO
Ïà¹ØÎĵµ£º
Óï·¨£º
select *
from ±íÃû
where Ìõ¼þ1
start with Ìõ¼þ2
connect by prior µ±Ç°±í×Ö¶Î=¼¶Áª±í×Ö¶Î
start withÓëconnect by priorÓï¾äÍê³ÉµÝ¹é¼Ç¼£¬ÐγÉÒ»¿ÃÊ÷Ðνṹ£¬Í¨³£¿ÉÒÔÔÚ¾ßÓвã´Î½á¹¹µÄ±íÖÐʹÓá£
start with±íʾ¿ªÊ¼µÄ¼Ç¼
connect by prior Ö¸¶¨Ó뵱ǰ¼Ç¼¹ØÁªÊ±µÄ×ֶιØϵ
´úÂ룺
--´´½¨²¿Ãű ......
Ò»£®Ïà¹ØµÄ¸ÅÄî
RowidµÄ¸ÅÄrowidÊÇÒ»¸öαÁУ¬¼ÈÈ»ÊÇαÁУ¬ÄÇôÕâ¸öÁоͲ»ÊÇÓû§¶¨Ò壬¶øÊÇϵͳ×Ô¼º¸ø¼ÓÉϵġ£¶Ôÿ¸ö±í¶¼ÓÐÒ»¸örowidµÄαÁУ¬µ«ÊÇ
±íÖв¢²»ÎïÀí´æ´¢ROWIDÁеÄÖµ¡£²»¹ýÄã¿ÉÒÔÏñʹÓÃÆäËüÁÐÄÇÑùʹÓÃËü£¬µ«ÊDz»ÄÜɾ³ý¸ÄÁУ¬Ò²²»ÄܶԸÃÁеÄÖµ½øÐÐÐ޸ġ¢²åÈë¡£Ò»µ©Ò»ÐÐÊý¾Ý²åÈëÊý¾Ý¿â£¬Ôò
rowidÔÚ¸ÃÐ ......
²ÎÊý
UNDO_MANAGEMENT = AUTO --¹ÜÀíģʽ,¿ÉΪAUTO»òMANUAL.Ö»ÄÜÔÚÆôʼ²ÎÊýÎļþÀïÃæÐÞ¸Ä
UNDO_TABLESPACE = undo --Öƶ¨´æ´¢»¹ÔÊý¾ÝµÄ±í¿Õ¼ä,Òà¿ÉÓÃALTER SYSTEM SET undo_tablespace = 'abc'À´¸ ......
alter system set nls_length_semantics='BYTE' scope=both
sql>show parameter length
NAME TYPE
------------------------------------ --------------------- ......
µÚÒ»¿Î£º¿Í»§¶Ë
1. Sql Plus(¿Í»§¶Ë£©£¬ÃüÁîÐÐÖ±½ÓÊäÈ룺sqlplus£¬È»ºó°´ÌáʾÊäÈëÓû§Ãû£¬ÃÜÂë¡£
2. ´Ó¿ªÊ¼³ÌÐòÔËÐÐ:sqlplus£¬ÊÇͼÐΰæµÄsqlplus.
3. http://localhost:5560/ ......