15.01.2013 Views

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

642 Part V: Object-Relational <strong>Database</strong>s<br />

Because there are three LOB columns, the create table command should be modified to<br />

include the storage specifications for the out-of-line LOB data (if you plan to store the LOB data<br />

out of line). Two of the LOB columns—Proposal_Text and Budget—will store data within the<br />

database. <strong>The</strong> revised version of the create table command, with the LOB storage clause specified,<br />

is shown in the following listing:<br />

create table PROPOSAL<br />

(Proposal_ID NUMBER(10),<br />

Recipient_Name VARCHAR2(25),<br />

Proposal_Name VARCHAR2(25),<br />

Short_Description VARCHAR2(1000),<br />

Proposal_Text CLOB,<br />

Budget BLOB,<br />

Cover_Letter BFILE,<br />

constraint PROPOSAL_PK primary key (Proposal_ID))<br />

tablespace PROPOSALS<br />

lob (Proposal_Text, Budget) store as<br />

(tablespace Proposal_Lobs<br />

storage (initial 100K next 100K pctincrease 0)<br />

chunk 16K pctversion 10 nocache logging);<br />

<strong>The</strong> last four lines of the create table command tell <strong>Oracle</strong> how to store the out-of-line LOB<br />

data. <strong>The</strong> instructions are as follows:<br />

lob (Proposal_Text, Budget) store as<br />

(tablespace Proposal_Lobs<br />

storage (initial 100K next 100K pctincrease 0)<br />

chunk 16K pctversion 10 nocache logging);<br />

<strong>The</strong> lob clause tells <strong>Oracle</strong> that the next set of commands deals with the out-of-line storage<br />

specifications for the table’s LOB columns. <strong>The</strong> two LOB columns (Proposal_Text and Budget) are<br />

explicitly listed. When the two columns’ values are stored out of line, they are stored in a segment<br />

as specified via the lob clause:<br />

lob (Proposal_Text, Budget) store as<br />

NOTE<br />

If there were only one LOB column, you could specify a name for the<br />

LOB segment. You would name the segment immediately after the<br />

store as clause in the preceding command.<br />

<strong>The</strong> next two lines specify the tablespace and storage parameters for the out-of-line LOB<br />

storage. <strong>The</strong> tablespace clause assigns the out-of-line data to the PROPOSAL_LOBS tablespace,<br />

and an optional storage clause can be used to specify the initial, next, and pctincrease values the<br />

out-of-line data storage will use. See the entry for the storage clause in the Alphabetical <strong>Reference</strong><br />

for an explanation of the available storage parameters for segments.<br />

(tablespace Proposal_Lobs<br />

Because the segments are for storing LOB data, several additional parameters are available,<br />

and they are specified within the lob clause:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!