SQL und Excel & Word Dokumente?

Hallo Experten,

ist es möglich komplette Excel- oder Worddokumente in einer Datenbank (in diesem Fall ORACLE) abzulegen.

Mein Problem ist:

Ich habe verschiedene Excel und Worddokumente, die im Intranet nur für bestimmte Leute lesbar und für wieder andere Leute änderbar ist. Dies würde ich gerne mit ASP machen. Und daher würde ich gerne eine Excel Tabbelle aus der Datenbank einlesen lassen und ggf. auch wieder verändert dort ablegen lassen. Wie kann man dieses bewerkstelligen?

Danke
BlueskyRW

Hi,
das ist unter Oracle sehr wohl möglich. Es gibt den Datentypfamilie LOB (Large Object): BLOB (binary LOB), CLOB (Character LOB für Ein-Byte-Zeichensätze), NCLOB (National Character LOB für 2-Byte-Zeichensätze) und BFILE (Zeiger auf Dateien auf Deinem Filesystem). Für Deine Zwecke würde ich BLOB oder CLOB nehmen; diese können bis 4GB groß sein.
Zugriff auf LOB-Daten geht nicht direkt über SQL, sondern über die mitgelieferte Package DBMS_LOB. Oracle liefert auch eine Visual Basic-Bibliothek, OO40, die damit umgehen kann; das ist vielleicht der beste Ansatz für ASP. Damit kenne ich mich nicht aus, aber hier ist ein Auszug aus der Oracle 8i-Doku:

Using Visual Basic (OO4O) to Work with LOBs

You can make changes to an entire internal LOB, or to pieces of the beginning, middle or end of it via the OO4O API. Specifically, you employ the OraBlob, OraClob and OraBFile objects. You can
access both internal and external LOBs for read purposes, and you can also write to internal LOBs.

The OraBlob, OraClob interfaces in OO4O provides methods for performing operations on large objects in the database including BLOB, CLOB and NCLOB data types. The OraBFile interface provides
methods for performing operations on BFILE data in the database. These interfaces (OraBlob, OraClob, OraBFile) encapsulate LOB locators, so the user does not deal with locators but instead uses the
methods and properties provided to perform operations and get state information.

OraMyBFile refers to the locator obtained from a PL/SQL „OUT“ parameter as a result of executing a PL/SQL procedure (either by doing an OraDatabase.ExecuteSQL or by using the OraSqlStmt
object). Note that an OraConnect.BeginTrans has been called since the locator became invalid after the COMMIT.

When OraBlob, OraClob objects are retrieved as a part of a dynaset, these objects represent LOB locators of the dynaset current row. If the dynaset current row changes due to move operation, OraBlob,
OraClob objects will represent LOB locator for the new current row. In order to retain the LOB locator of the OraBlob, OraClob object independent of the dynaset move operation, use the Clone method.
This method returns the OraBlob and OraClob object. One could also use these objects as PL/SQL bind parameters. Here is an example which shows both types of usage. The functions and samples are
explained in greater detail as part of the reference documentation.

Dim OraDyn as OraDynaset, OraSound1 as OraBLOB, OraSoundClone as OraBlob, 
OraMyBfile as OraBFile

OraConnection.BeginTrans
set OraDyn = OraDb.CreateDynaset("select \* from Multimedia\_tab order by clip\_
id", ORADYN\_DEFAULT)
set OraSound1 = OraDyn.Fields("Sound").value
set OraSoundClone = OraSound1

OraParameters.Add "id", 1,ORAPARAM\_INPUT
OraParameters.Add "mybfile", Empty,ORAPARAM\_OUTPUT
OraParameters("mybfile").ServerType = ORATYPE\_BFILE

OraDatabase.ExecuteSQL ("begin GetBFile(:id, :mybfile ") end")

Set OraMyBFile = OraParameters("mybfile").value
'Go to Next row
OraDyn.MoveNext

OraDyn.Edit
'Lets update OraSound1 data with that from the BFILE
OraSound1.CopyFromBFile OraMyBFile
OraDyn.Update

OraDyn.MoveNext
'Go to Next row
OraDyn.Edit
'Lets update OraSound1 by appending with LOB data from 1st row represenetd by 
'OraSoundClone
OraSound1.Append OraSoundClone
OraDyn.Update

OraConnection.CommitTrans

In the above example OraSound1 represents the locator for the current row in the dynaset where as OraSoundClone represents the locator for the 1st row. A change in the current row (say a
OraDyn.MoveNext) will mean that OraSound1 will actually represent locator for the 2nd row whereas OraSoundClone will represent the locator in the 1st row (OraSoundClone only refers the locator for the 1ast row irrespective of any OraDyn row navigation).

OraMyBFile refers to the locator got an PL/SQL „OUT“ parameter as a result of executing a PL/SQL procedure (either by doing an OraDatabase.ExecuteSQL or by using the OraSqlStmt object). Note
that an OraConnect.BeginTrans has been called since with a database „COMMIT“ the locator becomes invalid.

OO4O includes methods and properties that you can use to access data stored in BLOBs, CLOBs, NCLOBs, and BFILEs. These methods and properties are listed in the tables below, and are discussed in
greater detail later in the chapter.

See Also:

OO4O online help for detailed information including parameters, parameter types, return values, and example code.

Hoffe, geholfen zu haben!

Gruß

J.