Sie sind auf Seite 1von 3

Microsoft Windows [version 6.1.

7600]
Copyright (c) 2009 Microsoft Corporation. Tous droits rservs.
C:\Users\Amine>sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Sam. Janv. 26 20:06:13 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> conn
Entrez le nom utilisateur : GMA
Entrez le mot de passe :
Connect.
SQL> conn
Entrez le nom utilisateur : SYSTEM
Entrez le mot de passe :
Connect.
SQL> create or replace directory base as 'c:/DB';
Rpertoire cr.
SQL> grant read, write on directory base to GMA
2 /
Autorisation de privilges (GRANT) accepte.
SQL> grant dba to GMA;
Autorisation de privilges (GRANT) accepte.
SQL> conn
Entrez le nom utilisateur : GMA
Entrez le mot de passe :
Connect.
SQL> create table image_table
2 (id number primary key,
3 image ordsys.ordimage);
Table cre.
SQL> create or replace directory imadedir as 'c:/DB';
Rpertoire cr.
SQL> grant read on directory imagedir to GMA;
SQL> conn
Entrez le nom utilisateur : SYSTEM
Entrez le mot de passe :
Connect.
SQL> grant read on directory imagedir to GMA;
Autorisation de privilges (GRANT) accepte.
SQL> conn
Entrez le nom utilisateur : GMA
Entrez le mot de passe :

Connect.
SQL> create or replace procedure image_import
2 (dest_id number, filename varchar2) is img ordsys.ordimage;
3 ctx raw(64):=null;
4 begin
5 delete from image_table where id = dest_id;
6 insert into image_table (id,image)
7 values (dest_id,ordsys.ordimage.init())
8 returning image into img;
9 img.importFrom(ctx,'file','IMAGEDIR',filename);
10 update image_table set image=img where id=dest_id;
11 end;
12 /
Procdure cre.
SQL> call image_import(1,'CODE.gif');
Appel termin.

SQL> call image_import(2,'ACQUA.gif');


Appel termin.
SQL> select id, t.image.getheight(),
2 t.image.getwidth()
3 from image_table t;
ID T.IMAGE.GETHEIGHT() T.IMAGE.GETWIDTH()
---------- ------------------- -----------------1
81
81
2
238
238
SQL>
SQL>
2
3
4

select id,
t.image.getfileformat(),
t.image.getcompressionformat()
from image_table t where id =1;

ID
---------T.IMAGE.GETFILEFORMAT()
-------------------------------------------------------------------------------T.IMAGE.GETCOMPRESSIONFORMAT()
-------------------------------------------------------------------------------1
JFIF
JPEG
SQL>
2
3
4

select id,
t.image.getcontentformat(),
t.image.getcontentlength()
from image_table t;

ID
---------T.IMAGE.GETCONTENTFORMAT()
-------------------------------------------------------------------------------T.IMAGE.GETCONTENTLENGTH()
-------------------------1
24BITRGB
2946
2
24BITRGB
29892
ID
---------T.IMAGE.GETCONTENTFORMAT()
-------------------------------------------------------------------------------T.IMAGE.GETCONTENTLENGTH()
-------------------------SQL>

Das könnte Ihnen auch gefallen