Home » SQL & PL/SQL » SQL & PL/SQL » Comprimir una imagen utilizando AS_ZIP (Oracle Database 11g Release 11.2.0.4.0)
Comprimir una imagen utilizando AS_ZIP [message #677022] Wed, 07 August 2019 19:46 Go to next message
Bartholomew Kuma
Messages: 12
Registered: March 2019
Junior Member
Hi everybody,

I am trying to compress an image obtained from a table with the following code:

declare
  g_zipped_blob blob;
  V_Blob blob;
  l_clob CLOB;
begin
  Select Image Into V_Blob From Per_Images 
  Where Parent_Id =145777; 
  as_zip.add1file( g_zipped_blob, 'BlobFiles/test2.jpg', utl_raw.cast_to_raw(V_Blob) );
  as_zip.finish_zip( g_zipped_blob );
  as_zip.save_zip( g_zipped_blob, 'DEV_DIR', 'test.zip' );
  dbms_lob.freetemporary( g_zipped_blob );
end;

ORA-06550: line 8, column 58:
PLS-00306: wrong number or types of arguments in call to 'CAST_TO_RAW'
ORA-06550: line 8, column 3:
PL/SQL: Statement ignored

What am I doing wrong?
Re: Comprimir una imagen utilizando AS_ZIP [message #677023 is a reply to message #677022] Wed, 07 August 2019 20:05 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
You need to learn how to Read The Fine Manual YOURSELF!

https://docs.oracle.com/database/121/ARPLS/u_raw.htm#ARPLS71383


argument is VARCHAR2; not BLOB

CAST_TO_RAW Function
This function converts a VARCHAR2 value represented using some number of data bytes into a RAW value with that number of data bytes. The data itself is not modified in any way, but its datatype is recast to a RAW datatype.

Syntax

UTL_RAW.CAST_TO_RAW (
c IN VARCHAR2)
RETURN RAW;
Re: Comprimir una imagen utilizando AS_ZIP [message #677024 is a reply to message #677023] Wed, 07 August 2019 20:21 Go to previous messageGo to next message
Bartholomew Kuma
Messages: 12
Registered: March 2019
Junior Member
BlackSwan wrote on Wed, 07 August 2019 20:05
You need to learn how to Read The Fine Manual YOURSELF!

https://docs.oracle.com/database/121/ARPLS/u_raw.htm#ARPLS71383


argument is VARCHAR2; not BLOB

CAST_TO_RAW Function
This function converts a VARCHAR2 value represented using some number of data bytes into a RAW value with that number of data bytes. The data itself is not modified in any way, but its datatype is recast to a RAW datatype.

Syntax

UTL_RAW.CAST_TO_RAW (
c IN VARCHAR2)
RETURN RAW;
Hi BlackSwan,

I found the answer to my problem, as you just mentioned it is not necessary to use utl_raw.cast_to_raw when removing it the procedure worked.

Regards.
Re: Comprimir una imagen utilizando AS_ZIP [message #677026 is a reply to message #677024] Thu, 08 August 2019 00:38 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Why don't you feedback in your previous topic?
You use what we gave you, why didn't you tell us it is what you searched and it helps you for you job?

Previous Topic: Is it possible to insert a folder from a directory into a table?
Next Topic: Union and sort the data based on date range
Goto Forum:
  


Current Time: Thu Mar 28 17:22:27 CDT 2024