PDF SQL Prof

Embed Size (px)

DESCRIPTION

hfkjfhkfklfhkljhlkgjlkgg

Citation preview

Microsoft Windows [version 6.1.7600]Copyright (c) 2009 Microsoft Corporation. Tous droits rservs.C:\Users\Amine>sqlplus /nologSQL*Plus: Release 11.2.0.1.0 Production on Sam. Janv. 26 20:06:13 2013Copyright (c) 1982, 2010, Oracle. All rights reserved.SQL> connEntrez le nom utilisateur : GMAEntrez le mot de passe :Connect.SQL> connEntrez le nom utilisateur : SYSTEMEntrez 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> connEntrez le nom utilisateur : GMAEntrez 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> connEntrez le nom utilisateur : SYSTEMEntrez le mot de passe :Connect.SQL> grant read on directory imagedir to GMA;Autorisation de privilges (GRANT) accepte.SQL> connEntrez le nom utilisateur : GMAEntrez 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 238SQL>SQL> select id, 2 t.image.getfileformat(), 3 t.image.getcompressionformat() 4 from image_table t where id =1; ID----------T.IMAGE.GETFILEFORMAT()--------------------------------------------------------------------------------T.IMAGE.GETCOMPRESSIONFORMAT()-------------------------------------------------------------------------------- 1JFIFJPEGSQL> select id, 2 t.image.getcontentformat(), 3 t.image.getcontentlength() 4 from image_table t; ID----------T.IMAGE.GETCONTENTFORMAT()--------------------------------------------------------------------------------T.IMAGE.GETCONTENTLENGTH()-------------------------- 124BITRGB 2946 224BITRGB 29892 ID----------T.IMAGE.GETCONTENTFORMAT()--------------------------------------------------------------------------------T.IMAGE.GETCONTENTLENGTH()--------------------------SQL>