Storing Images on Oracle Xe

DBA Geral (instalação, configuração do banco, scripts do Sql*Plus, shell scripts, batch scripts, etc...)
Post Reply
eduardo.d2
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 67
Joined: Tue, 08 Jan 2008 9:13 pm
Location: são paulo
Eduardo Andrade

Environment information:
* Oracle version: 10 XE
* Operating system: XP

Good afternoon everyone would like to know how to store image in Oracle 10 XE ? I just want to store the computer for the direct bank without help of any ASP, asp.net etc. this is possible?

From now on, thank you and even +
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Brother,

I know, you would have to do with PL / SQL, in this case, a procedure, to perform this insert.
Wanted here in the forum by BLOB or image that will locate interesting topics.
eduardo.d2
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 67
Joined: Tue, 08 Jan 2008 9:13 pm
Location: são paulo
Eduardo Andrade

Then take the example of a face in the forum, plus this returning a lot of error
this and the code

Select all

 
[CREATE OR REPLACE DIRECTORY DIR_IMAGEN 
AS 'c:\MEUS~DOCUMENTOS\MINHAS~IMAGENS' 
 
DECLARE 
 
L_BLOB BLOB; 
L_BFILE BFILE; 
 
BEGIN 
INSERT INTO CLIENTESFOTO 
VALUES (EMPTY_BLOB()) 
RETURNING IMAGE INTO L_BLOB; 
 
L_BFILE := BFILENAME('c:\MEUS~DOCUMENTOS\MINHASIMAGENS','transformers_9_1024.JPEG');  
 
 
DBMS_LOB.FILEOPEN(L_BFILE); 
DBMS_LOB.loadfromfile(L_BLOB,L_BFILE,DBMS_LOB.GETLENGTH(L_BFILE)); 
DBMS_LOB.fileclose(L_BFILE); 
 
END;] 
and this and the error
[Error Starting at Line 1 In Command:

Select all

 
CREATE OR REPLACE DIRECTORY DIR_IMAGEN 
AS 'c:\MEUS~DOCUMENTOS\MINHAS~IMAGENS' 
 
DECLARE 
 
L_BLOB BLOB
Error:

Select all

Error at Command Line:2 Column:38 
Error report: 
SQL Error: ORA-00901: comando CREATE inválido 
00901. 00000 -  "invalid CREATE command" 
*Cause:     
*Action: 
 
Error starting at line 7 in command: 
L_BFILE BFILE; 
Error report: 
Unknown Command 
 
Error starting at line 9 in command: 
BEGIN 
INSERT INTO CLIENTESFOTO 
VALUES (EMPTY_BLOB()) 
RETURNING IMAGE INTO L_BLOB; 
 
L_BFILE := BFILENAME('c:\MEUS~DOCUMENTOS\MINHASIMAGENS','transformers_9_1024.JPEG');  
 
 
DBMS_LOB.FILEOPEN(L_BFILE); 
DBMS_LOB.loadfromfile(L_BLOB,L_BFILE,DBMS_LOB.GETLENGTH(L_BFILE)); 
DBMS_LOB.fileclose(L_BFILE); 
Error report: 
ORA-06550: linha 11, coluna 28: 
PLS-00103: Encontrado o símbolo "end-of-file" quando um dos seguintes símbolos era esperado: 
 
   begin case declare end exception exit for goto if loop mod 
   null pragma raise return select update while with 
   <um identificador> 
   <um identificador delimitado por aspas duplas> 
   <uma variável de ligação> << close current delete fetch 
   lock insert open rollback savepoint set sql execute commit 
   forall merge pipe 
06550. 00000 -  "line %s, column %s:\n%s" 
*Cause:    Usually a PL/SQL compilation error. 
*Action:
From now on, my thank you
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

Try to change the
directory
Create the test folder in the root
and use the PATH C: \ test

I have already had many problems by installing products Oracle in the folder files and programs .. I think in the world Oracle folders with blank spaces does not work very well not

arm
eduardo.d2
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 67
Joined: Tue, 08 Jan 2008 9:13 pm
Location: são paulo
Eduardo Andrade

Select all

DECLARE 
 
L_BLOB BLOB; 
L_BFILE BFILE; 
 
BEGIN 
INSERT INTO CLIENTESFOTO(CODIGO, 
                         FOTO) 
VALUES (01, 
        EMPTY_BLOB()) 
RETURNING CLIENTESFOTO INTO L_BLOB; 
 
L_BFILE := BFILENAME('DIR_IMAGEN','kenshin_17_1024.JPEG'); 
 
DBMS_LOB.FILEOPEN(L_BFILE); 
DBMS_LOB.loadfromfile(L_BLOB,L_BFILE,DBMS_LOB.GETLENGTH(L_BFILE)); 
DBMS_LOB.fileclose(L_BFILE); 
 
END; 


is returning this error
Error Starting at Line 1 in Command:

Select all

DECLARE 
 
L_BLOB BLOB; 
L_BFILE BFILE; 
 
BEGIN 
INSERT INTO CLIENTESFOTO(CODIGO, 
                         FOTO) 
VALUES (01, 
        EMPTY_BLOB()) 
RETURNING CLIENTESFOTO INTO L_BLOB; 
 
L_BFILE := BFILENAME('DIR_IMAGEN','kenshin_17_1024.JPEG'); 
 
DBMS_LOB.FILEOPEN(L_BFILE); 
DBMS_LOB.loadfromfile(L_BLOB,L_BFILE,DBMS_LOB.GETLENGTH(L_BFILE)); 
DBMS_LOB.fileclose(L_BFILE); 
 
END;  
Error report: 
ORA-06550: linha 11, coluna 11: 
PL/SQL: ORA-00904: "CLIENTESFOTO": identificador inválido 
ORA-06550: linha 7, coluna 1: 
PL/SQL: SQL Statement ignored 
06550. 00000 -  "line %s, column %s:\n%s" 
*Cause:    Usually a PL/SQL compilation error. 
*Action:
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Brother, beleza?

Then you are giving the all-table return (customers) in the Lob variable (l_blob).

See this example below: [url=http://en.glufke.net/oracle/viewtopic.p ... =returning]http://en.glufke.net/oracle/viewtopic.p ... =returning

You must give the return of 1 field in a variable and, if you have more than one field, the Returning in N variables.

Whatever, send it there.
eduardo.d2
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 67
Joined: Tue, 08 Jan 2008 9:13 pm
Location: são paulo
Eduardo Andrade

Bro !! I do not understand how to explain again?

Thanks !!!
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest