Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BLOBs in Oracle-DB einfügen!

Empfohlene Antworten

Veröffentlicht

Hi

Will ein Bild in eine Orcale DAtenbank speichern! Dieses Feld in dem das Bild gespeichert wird soll den Typ BLOB haben! Nun ich einiges gefunden jedoch gibt es bei mir immer diesen Fehler:

Warning: Type created with compilation errors.

Mein Import File sieht so aus:

CREATE OR REPLACE TYPE ORDImage

AS OBJECT (STATIC FUNCTION init(

location

srcType IN VARCHAR2,

srcLocation IN VARCHAR2,

srcName IN VARCHAR2) RETURN ORDImage);

DECLARE

myImage ORDSYS.ORDImage;

BEGIN

myImage := ORDSYS.ORDImage.init('BLOB','FILE','IMGDIR','/home/gis/czadra/www/bilder/cyrill.jpg');;

INSERT INTO bild

(idb, idh, bild, bildname, descr, comm) VALUES

(bildkeygen.NextVal, '1', myImage, 'TEST BILD 1', 'TEST BILD 2', 'COMMENTS');

COMMIT;

END;

/

Hat irgend jemand ne Ahnung warum das nicht funktioniert!!

Hi,

verstehe ich richtig... du moechtest einen bild in die DB , in eine Tabelle, in ein BLOB-Feld einfuegen?

Dafuer nimmst du ein Beispiel fragwuerdiger Herrkunft und versuchst ein Type zu createn, der auf einer Funktion und einem ORDSYS-Package basiert... warum, erstell doch zuerst die Tablelle (oder gibts die schon? Ist die es? location

srcType IN VARCHAR2,

srcLocation IN VARCHAR2,

srcName IN VARCHAR2???)

Sag doch konkeret, was du hast, was du moechtest und ich helfe dir gern.

Gruesse

Denise

Hi,

wie bereits oben erwähnt musst Du eine entsprechende Tabelle erstellen:

CREATE TABLE Bilder(Spalte1 VARCHAR(50),Spalte2 INTEGER,Spalte3 VARCHAR(50),

Spalte4 INTEGER, photo ORDSYS.ORDImage);

Hiermit erstellst Du eine Tabelle mit 4 "normalen" Spalten und einer Spalte für Dein Bild namens "photo".

So, und jetzt kannst Du in diese Tabelle das Bild aus einer Datei einfügen:

DECLARE

Image ORDSYS.ORDImage;-- application variables

ctx RAW(4000) := NULL;

BEGIN

INSERT INTO Bilder VALUES ('Test1', 12345, 'Test2', 123,

ORDSYS.ORDImage.init());

SELECT photo INTO Image FROM Bilder WHERE ename = 'Test1' for UPDATE;

Image.setSource('FILE', 'IMGDIR', 'cyrill.jpg'); Image.import(ctx);

UPDATE Bilder SET photo = Image WHERE ename = 'Test1'; COMMIT;

END;

Jetzt sollte das Bild in der Spalte "photo" eingefügt sein.

Übrigens handelt es sich bei ORDSYS.ORDImage um den Intermedia-Datentyp, mit dem man Bilddaten in DB einfügt.

twin

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.