Professional Documents
Culture Documents
Rmoug14-St - Hilaire-Clob Blob Lob v2
Rmoug14-St - Hilaire-Clob Blob Lob v2
com
The Plan
• Intro
• The Goal
• APEX BLOB Wizard
• Making It Your Own
• Base Technology
• Advanced Database Concepts
• Questions
@sthilaire wphilltech.com
Introduction
Tim St. Hilaire
• System Integrator
• Problems Solver
• Pragmatist
• Technology Enthusiast
• APEX Fan
• Enkitec Product Developer
@sthilaire wphilltech.com
The Goal
• Ability to accept file attachment input from
users in an application
• Use the content in applications either as text,
images, or downloadable to users
• Understand how the data is stored, retrieved,
and managed inside the database
@sthilaire wphilltech.com
The Academics
@sthilaire wphilltech.com
The Academics
• LOB – Large Objects – broken down into
datatypes
– BLOB - Stores unstructured binary data in the
database as a bit stream
– CLOB – Stores large amounts of text such as XML in
the database character set
– NCLOB – National Character Set LOB – stores Unicode
data
– BFILE – external LOB
– Secure File LOB – file data enabling advanced features
such as compression and encryption
@sthilaire wphilltech.com
SELECT * FROM
NLS_DATABASE_PARAMETERS WHERE
PARAMETER = 'NLS_CHARACTERSET';
@sthilaire wphilltech.com
-- The Internet
@sthilaire wphilltech.com
APEX
@sthilaire wphilltech.com
Evaluate WWV_FLOW_FILES
Pros Cons
• No Table Creations Required • Need Remote Key Storage
• Consistent Implementation • Application Files combined
• Storage in a known location • Storage for all Workspaces
is shared
• Some Files are publicly
available
@sthilaire wphilltech.com
Custom Table
@sthilaire wphilltech.com
My Table
• To configure your own table
• Minimum Requirements
• Adjust to Features and Business Requirements
Custom Table
CREATE TABLE MY_APEX_FILES(
BLOB_ID NUMBER NOT NULL,
NAME VARCHAR2(100 BYTE),
DESCRIPTION VARCHAR2(2000 BYTE),
CATEGORY VARCHAR2(200 BYTE),
PUBLIC_FLAG VARCHAR2(1 BYTE),
BLOB_CONTENT BLOB,
BLOB_SIZE NUMBER,
MIME_TYPE VARCHAR2(255 BYTE),
FILE_NAME VARCHAR2(255 BYTE),
CREATED_BY VARCHAR2(50 BYTE),
CREATED_ON DATE,
UPDATED_BY VARCHAR2(50 BYTE),
UPDATED_ON DATE);
@sthilaire wphilltech.com
Referencing
@sthilaire wphilltech.com
Form - Difference
<img id="P210_IMAGE" <img
src="apex_util.get_blob_file id="P210_IMAGE_SELECT"
?a=500&s=9700348909 src="wwv_flow.show?p_req
98301&p=210&d= uest=NATIVE%3DC825C6CF6
27553826455759041&i 97537EC53FBD9065B8B082
=27566106354076381& 7585481276038A327CEF5A
;p_pk1=3212306414813867 150CAC67389&p_insta
83828770868593367722825 nce=970034890998301&am
&p_pk2=&p_ck=D p;p_flow_id=500&p_fl
164075B30411E1CF29B6B9 ow_step_id=210">
ED9A57684" alt="Hunger"
title="Hunger">
@sthilaire wphilltech.com
CASE
WHEN MIME_TYPE LIKE 'image%' THEN
'<img
src="'||apex_util.get_blob_file_src
(
'P210_BLOB_CONTENT',ID)||
'" height="75" width="75" />'
ELSE NULL
END as shrunk
@sthilaire wphilltech.com
Text
@sthilaire wphilltech.com
Quiz
What is the size limit of a VARCHAR2?
(A) 255
(B) 2000
(C) 4000
(D) 32767
(E) 8 Terabytes
(F) Whatever it is defined as….
@sthilaire wphilltech.com
Maximum Width
@sthilaire wphilltech.com
@apexins.sql @apexins.sql
Tablespace_apex SYSAUX
tablespace_files SYSAUX
tablespace_temp TEMP
images /i/
@sthilaire wphilltech.com
Size of Tables
SELECT
l.table_name||'-lob',
s.bytes
FROM user_lobs l,
user_segments s
WHERE
s.segment_name = l.segment_name
AND
s.segment_type = 'LOBSEGMENT'
@sthilaire wphilltech.com
Size Matters
References
Many thanks to all those that have come before me, and for those that take the time to help others grow and
improve their skills by sharing their time an knowledge.
• Enkitec Plugin
– http://www.enkitec.com/products/plugins
• Demonstration Application
– http://wphilltech.com
• APEX Docs
– BLOB in APEX 17.10
http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/advnc_blob.htm#HTMDB25906
– GET_BLOB_FILE_SRC
http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_util.htm#AEAPI129
• DBMS_LOB
– http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_lob.htm
• Oracle SecureFiles and Large Objects
– http://docs.oracle.com/cd/E11882_01/appdev.112/e18294/adlob_tables.htm
– http://docs.oracle.com/cd/E11882_01/appdev.112/e18294/adlob_lob_ops.htm
• APEX Builder - BLOB Support in Forms and Reports
– http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/advnc_blob.htm
• Icons
– http://www.stdicon.com/
@sthilaire wphilltech.com
Disclaimer
• Marks, images, brands and referenced content are the
property of their respective owners. Usage is for
discussion purposes only. No ownership assumed or
implied.
• The comments and opinions expressed here are sole
responsibility of the author and not of his employer or
any other party.
• No trees were harmed during the creation of this
presentation. However, a great number of electrons
were terribly inconvenienced.