[ Download Code ]
I am a fan of utilizing any tool that makes my life easier as a developer and one such tool that I love when working with and Oracle database is PL/SQL Developer and you can find out more on this product at AllRoundAutomations.
Just to give you idea of this product take a look at this screenshot.
To establish the table which will hold the necessary data this article covers run the following:
-- Author: Steven M. Swafford
-- Date Created: 23-NOV-2004
-- Create Table(s)
CREATE TABLE SMSTestBlob
(
id number,
photo BLOB,
author varchar2(100),
description varchar2(500)
);
Now that we have our table established the next step is to create your primary/foreign keys. To accomplish this step run the following SQL statement:
-- Author: Steven M. Swafford
-- Date Created: 23-NOV-2004
-- Create/Recreate primary, unique and foreign key constraints
alter table SMSTESTBLOB
add constraint PK_SMSTESTBLOB_ID primary key (ID);
Finally the sequence.
-- Author: Steven M. Swafford
-- Date Created: 01-DEC-2004
-- Create sequence
create sequence smstestblobid_seq
minvalue 1
maxvalue 999999999999
start with 1
increment by 1
cache 20
cycle
order;
Once you have established your table you will have a schema such as the following.
Now that the database is ready it is now time to transition to the code which will perform the necessary steps to insert our records. The code of choice is C# so sit back and prepare yourself.