Column length of a LONG RAW column
How to find out the column length of a LONG RAW column, to compute the average row size in Oracle 7.3.4
Thanks.
The Member Feedback forum is for suggestions and feedback for OTN Developer Services. This forum is not monitored by Oracle support or product teams and so Oracle product and technology related questions will not be answered. We recommend that you post this thread to the Database - General forum. General Database Discussions
OTN
Similar Messages
-
Hi!
Is it possible to get the length or size of a LONG RAW image stored in the database?
Thanks for any help you can give. =)
nullHAVE A LOOK AT THE VSIZE FUNCTION, I THINK THAT WOULD DO IT
null -
Restrict the LONG RAW Column with less than 32760 bytes in the SELECT
When i am trying to access a LONG RAW Dataype wchich has characters greter than 32760 bytes i am getting this error.
Error -6502: ORA-06502: PL/SQL: numeric or value error
I came to know that PL/SQL will only be able to access the first 32760 bytes of a LONG RAW. If we try to fetch a LONG RAW from the database into PL/SQL variable which exceeds the 32760 byte limit then we encountered the above error.
Can anyone tell to avoid this error can we write a query to restrict the output to get only those records which has LONG RAW length less than 32760 bytes.
Since we canot use utl_raw.length() in the Select Statement, is there any function to restrict the the records for less than 32760 Bytes only for LONG RAW datatype, so that i will not get any records for more than 32760 bytes and we will not get this error.
REquest you to please help.Hi
we do not have an option of migrating the LONG RAW to BLOB or any kind of ALTER to the table.
We want to restrict the use of Records from the Table which has data for LONG RAW column less than 32760 bytes, so that we will not get the PL/SQL numberic Error
any function for LONG RAW that can be used in SQL like for varchar2 we can use
select length(NAME) < 100 from tb_emp+
i.e it will get records only which has NAME less than 100 characters. -
I have a table with a column of type LONG RAW that can take binary content of arbitrary length (up to 2 GB). I try to copy content from one row to another using the following SQL:
UPDATE TEAM_ADM.Content SET (Content, ContentType) =
(SELECT Content, ContentType FROM Content WHERE ContentId = in_SourceContentID)
WHERE ContentID = in_TargetContentID;
Content.Content is the column in question.
Oracle returns with error ORA-00997:
ORA-00997 illegal use of LONG datatype
Cause: A value of datatype LONG was used in a function or in a DISTINCT, WHERE, CONNECT BY, GROUP BY, or ORDER BY clause. A LONG value can only be used in a SELECT clause.
Action: Remove the LONG value from the function or clause.
Question: How can I copy a LONG RAW column from one row to another?
Regards,
Kjell TangenHello,
It seems that the Long datatypes in Oracle have a lot of restrictions. According to
this blog:LONG and LONG RAW columns cannot be used in distributed SQL statements.
In that case, you should update the long raw column on the Oracle side. You can try to use openquery as Rick post above to send the SQL statment to Oracle and execute.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
How to find out the length of a LONG column?
How can I find out the length of a LONG column, I should write a stored procedure which will return me the length of a LONG column passed as an argument to it!
any ideas or suggestions? please respond, i need this urgently, or you can mail me at [email protected]
thanks,
sriniActually a LONG variable in PL/SQL maxes out at 32K, so this would not be accruate. If you are running Oracle 8+, you could do a conversion to LOB which will give you an accurate length. Note, this example needs a table created to hold the converted lob value, you can't do it directly in pl/sql:
create table lobhold
(templob clob);
declare
mylength number;
begin
execute immediate 'insert into lobhold select to_lob(text) from equipment_notes where equipment_id=1448';
select dbms_lob.getlength(templob) into mylength
from templob;
dbms_output.put_line(mylength);
execute immediate 'truncate table lobhold';
end; -
ORA-22835: buffer too small when trying to save pdf file in LONG RAW column
Hi,
I get "ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (real : 125695, maximum : 2000)" when i trying to save a 120k pdf file in an Oracle Long Raw column using dotnet 4.0 and Entity FrameWork.
Dim db As New OracleEntities
Try
Dim myEntity = (From e In db.TEXTE _
Where e.TEXT_ID = txtTextId.Text _
Select e).Single
With myEntity
If txtTextypeId.Text <> "" Then
.TEXTYPE_ID = txtTextypeId.Text
Else
.TEXTYPE_ID = Nothing
End If
.TEXT_NUM = txtTextNum.Text
.TEXT_NAME = txtTextName.Text
.TEXT_DATE = dtTextDate.SelectedDate
If DocAdded Then
.TEXT_DOC = Document
ElseIf DocDeleted Then
.TEXT_DOC = Nothing
End If
End With
db.SaveChanges()
Document is an array of Byte and TEXT_DOC also (mapped to a long row column).
is it possible to increase the size of the buffer ? how may i do it ?
Thx in advance.
Regards.Using a custom UPDATE or INSERT stored procedure for LONG RAW column with
exceed-limit data may still get the following error.
"ORA-01460: unimplemented or unreasonable conversion requested".
One option is to use BLOB instead of LONG RAW in your table and regenerate your
data model from the table. Then using the default UPDATE or INSERT statement
(created by EF) should work.
The following will modify your LONG RAW column to BLOB column.
Disclaimers:
1. It's irreversible--you cannot modify BLOB back to LONG RAW.
2. I have not tried that when there are huge data in LONG RAW column.
So be careful.
alter table <your_table_name> modify <your_long_raw_type_column> blob; -
How to view contents in Long Raw datatype column
Hi,
We have two node RAC database with 10.2.0.4.0 version.
OS - IBM AIX.
We have a table with a column with datatype "LONG RAW" in production. It stores image files.
We need to send the images from few rows to third party vendor. Basically, they need to view the images.
Earlier, I have exported to dump file using datapump and sent to vendor. but vendor is telling that they are not able to view the images. Can you please suggest best method to transfer the images (LONG RAW datatype) and the method to view them.We have a table with a column with datatype "LONG RAW" in production. It stores image files.
We need to send the images from few rows to third party vendor. Basically, they need to view the images.
Earlier, I have exported to dump file using datapump and sent to vendor. but vendor is telling that they are not able to view the images. Can you please suggest best method to transfer the images (LONG RAW datatype) and the method to view them.How is the vendor trying to use the extracted images? Data exported with datapump must be imported into another database with datapump. The same applies to the exp utility (must use imp to load into a database).
If you're careful you should be able to write a binary file using utl_file.
Regarding the long raw, is there any way you could convert to BLOBS? Longs and Long raws are notoriously hard to work with -
Hi Everybody,
I am using Oracle 9i ver 9.1 & Developer 6. My requirement is to store documents in the database. For that I have created a Long RAW column in the table where I have to store that. On forms I have made an OLE Container whose OLE Class property is set to "Word.Document.8". When I run the form, everyting goes fine. I insert the record, with word documents, it saves. I cleared the form & when I query it gets back the document, ie I can open it by double clicking it. But, once I exit the screen, run it again & try to query, it fetches all other columns except the OLE container value. I mean when I query it after exiting once & running the screen again, it does not fetch that OLE container base table items value, which it displays if I query it, without exiting, ie, the time when I inserted the document in OLE container, saved it & cleared the screen.
Anyone having a work around pls, reply.
Thanks in Advance.
[email protected]Hi,
Yes the data is getting saved. As, when i clear the screen & then query again it displays the data. At SQL promp, when i qureied the table, it displays on a single "D" as the column values for all the rows, whether I had inserted any value for that row or not. I mean it was displaying "D" in all the rows, though, I have not inserted value in all rows in the Long Raw Column.
Rgds,
[email protected] -
Modify long raw to blob column
Hello,
I would like to know if it is possible to modify a long raw column into a blob column, without having to drop and recreate my table.
There is already data inserted in the long raw column.
Thanks in advance,
Cindy'Fraid not.
A LOB is stored "out-of-line", which means the actual "raw" data is held separately from the table. A long raw stores the data in-line. This means that you'll have to write some code to extract the "raw" data and write it to the LOB. Methinks you won't be able to add a LOB-type column to the table if you have a long raw existing in it already. -
6i to 9i conversion OLE container stored in a LONG RAW column to BLOB
I need to automate the migration of data stored in a long raw column to a blob column. The objects were stored in the long raw column using an Oracle Forms 6i OLE container. There is also multiple object types stored in the column, ie (word, excel, images, but mostly pdf's). I have looked at the webutil package but cannot figure out how to read the long raw column since ole containers are obsolete in 9i. I have a lot of records that need migrating and need help.
Thanks,
J. Broome
[email protected]It doesn't appear that I am able to attach the PDF files. Can you supply your email (or I can supply mine) so I can send you the three files:
1.) A good PDF (manually extracted from our old application)
2.) Dump of the same PDF file (includes header/footer info)
3.) A partially fixed PDF file (but some of the pictures / pages are cut off - specifically pages 3,5,9,10,12,14)
The way that we have tried to fix the file (in example 3 above) is the following:
a.) Find the First Occurrence of "%PDF-"
b.) Find the Last Occurrence of "%%EOF"
c.) if the first "%PDF-" is found AND the last "%%EOF" is found, then
i.) Remove all data before the first %PDF-
ii.) Remove all data after the last %%EOF
Let me know if you need any other information.
Thanks,
Mike -
Memory Leak with Oracle ODBC Driver for Long Raw columns
Oracle version : 8.1.7
Platform : Win2K
Oracle ODBC Driver version : 8.0.1.7.5.0.0
Hi,
I've got an Oracle database upgraded from
V8.0.5 to V8.1.7 which has a table having one long raw +
normal columns. I was able to observe distinct memory
leaks (approx 80K) when using ODBC interface calls (thro C++ code) that referenced a combination of normal & long raw columns in a select statement. However, this leak was not observed when only normal columns were present in the
select statement. Is there any known restriction for using
long raw columns with other columns? Or do long raw columns have a known memory leak problem thro ODBC?
Thanks!
Regards
SanchayanDid you ever get an answer on this issue?
Thanks in advance -
How to differentiate picture formats in LONG RAW column?
Hi,
I have a table with a long raw column that contains pictures. I would like to know for each row if the picture in the long raw column is in JPEG, TIFF, BMP, etc.
Does somebody have an idea on how to do this?
Thanks!
Matt1) You really shouldn't be using LONG or LONG RAW data types any longer. You should at least be using BLOB data types here.
2) When you designed the schema, there should have been columns (or other tables) to store metadata about the file, including the type of image a row stores.
3) Lacking any of this, you could write a program that fetches the data and determines whether it is a valid JPEG, then checks to see if it is a valid TIFF, etc. until it happens upon a file format that appears to work. Obviously, though, that is a relatively costly exercise. If that's what you're forced to do, I'd strongly encourage you to store that information in a (potentially new) column in the database so you only have to do it once.
Justin -
How to insert records with LONG RAW columns from one table to another
Does anybody know how to use subquery to insert records with columns of LONG RAW datatype from one table to another? Can I add a WHERE clause in the subquery statement? Thanks.
Insert into ... Select statements are not supported for long or long raw. You will have to either use PL/SQL or convert your long raw to blobs.
-
How to load image in Long Raw column?
Dear all,
I need to upload a jpg image to a Long Raw column in one of our tables. Is there a way or utility so that I can do this thru a PL/SQL code? Please help.
Regards,
AmitYou must not be using LONG data type. It has been deprecated. You must be using BLOB. Here is an extract from AskTom.com on how to load a file into BLOB field.
create table demo
( id int primary key,
theBlob blob
create or replace directory my_files as '/export/home/tkyte/public_html';
declare
l_blob blob;
l_bfile bfile;
begin
insert into demo values ( 1, empty_blob() )
returning theBlob into l_blob;
l_bfile := bfilename( 'MY_FILES', 'aria.gif' );
dbms_lob.fileopen( l_bfile );
dbms_lob.loadfromfile( l_blob, l_bfile,
dbms_lob.getlength( l_bfile ) );
dbms_lob.fileclose( l_bfile );
end;
/Below is the link for the same.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:232814159006 -
Load image file into a LONG RAW column via SQL*Loader
Does anyone know how to load a image file into a LONG RAW column via SQL*Loader?
Thanks
-Hsing-Hua-Are you trying to import the image on the client into Oracle lite, or from the server end into the main oracle database for download to the client?
On our system images are loaded into the the oracle lite database (10g R1 at the moment) on the client (DELL X50 PDA's) into a BLOB (Not LONG RAW) column using Java (relatively standard functionality in Java) as this is what our application software is written in.
From the server end, we do not at the moment load images as such, but we do load the application software into the database for deployment of new versions to the clients (the DMC/DMS updates we have found very unreliable), and the technique should be the same for images. Again the file is imported into a BLOB column.
NOTE a column defined as BLOB on the main Oracle database appears as a LONG VARBINARY on the client Oracle lite database, but the synchronisation process handles the conversion with no problem.
To import into a BLOB column on the server try the following
1) you will need to create a DIRECTORY (CREATE DIRECTORY command) within the database, pointing at a directory on the database server (or accessible from it). This is needed for the file location.
CREATE OR REPLACE DIRECTORY PDA_FILE_UPLOAD AS '/pdaapps/jar/'
NOTE create directory needs to be run as SYSTEM
2) define your table to hold the image and other data. Our tables is
SQL> desc pda_applications
Name Null? Type
ID NOT NULL NUMBER(12)
PDAAT_CODE NOT NULL VARCHAR2(10)
VERSION NOT NULL NUMBER(5,2)
PART_NO NOT NULL NUMBER(3)
FILE_OBJECT BLOB
DEPLOY_APPLICATION_YN NOT NULL VARCHAR2(1)
3) copy the image (or in our case a .jar file) to the database server directory specified in step 1
4) the actual import is done using a DBMB_LOB procedure
PROCEDURE pr_load_file
Module Name : pr_load_file
Description : Main call. Create a new pda_applications record, and import the specified file into it
Version History:
Vers. Author Date Reason
1.0 G Wilkinson 03/02/2006 Initial Version.
(PA_VERSION IN NUMBER
,PA_FILENAME IN VARCHAR2
,PA_PDAAT_CODE IN VARCHAR2
,PA_PART_NO IN NUMBER DEFAULT 1
,PA_DEPLOY IN VARCHAR2 DEFAULT 'Y')
IS
l_FileLocator BFILE;
l_blobLocator BLOB;
l_seq NUMBER;
l_location VARCHAR2(20);
no_params EXCEPTION;
call_fail EXCEPTION;
BEGIN
-- Throw error if required details not present
IF pa_version IS NULL
OR pa_filename IS NULL
OR pa_pdaat_code IS NULL THEN
RAISE no_params;
END IF;
-- Initialize the BLOB locator for writing. Note that we have
-- to import a blob into a table as part of a SELECT FOR UPDATE. This locks the row,
-- and is a requirement for LOADFROMFILE.
SELECT pdaa_id_seq.nextval
INTO l_seq
FROM dual;
-- First create the application record (file is imported by update, not insert
INSERT INTO pda_applications
(ID,PDAAT_CODE,VERSION,PART_NO,FILE_OBJECT,DEPLOY_APPLICATION_YN)
VALUES (l_seq,pa_pdaat_code,pa_version,pa_part_no,EMPTY_BLOB(),pa_deploy);
-- Lock record for update to import the file
SELECT file_object INTO l_blobLocator
FROM pda_applications
WHERE id=l_seq
FOR UPDATE;
-- Initialize the BFILE locator for reading.
l_FileLocator := BFILENAME('PDA_FILE_UPLOAD', pa_filename);
DBMS_LOB.FILEOPEN(l_FileLocator, DBMS_LOB.FILE_READONLY);
-- Load the entire file into the character LOB.
-- This is necessary so that we have the data in
-- character rather than RAW variables.
DBMS_LOB.LOADFROMFILE(l_blobLocator, l_FileLocator
,DBMS_LOB.GETLENGTH(l_FileLocator)
,src_offset => 1);
-- Clean up.
DBMS_LOB.FILECLOSE(l_FileLocator);
-- Create download records for each user associated with the application for sending to the PDA's
-- to install the software
IF pa_deploy = 'Y' then
IF fn_deploy (pa_pdaa_id => l_seq
,pa_pdaat_code => pa_pdaat_code) != 'SUCCESS' THEN
RAISE call_fail;
END IF;
END IF;
EXCEPTION
WHEN no_params THEN
pkg_appm.pr_log_message( pa_mdl_name => g_module_name
, pa_mdl_version => fn_get_body_version
, pa_error_code => SQLCODE
, pa_location => l_location
, pa_text => 'Missing parameters'
, pa_severity => 'E'
WHEN OTHERS THEN
DBMS_LOB.FILECLOSE(l_FileLocator);
pkg_appm.pr_log_message( pa_mdl_name => g_module_name
, pa_mdl_version => fn_get_body_version
, pa_error_code => SQLCODE
, pa_location => l_location
, pa_text => SQLERRM
, pa_severity => 'E'
END pr_load_file;
I hope this may be of some help
Maybe you are looking for
-
IPhone wont let me listen to music or update apps
Hello. When i go to the Music app and press a song it freezes and doesn't play it or it will be on play but it will just be at 0:00 and not start the song. I always try to turn up the volume but it freezes and doesn't work. I ushally have to double c
-
SID Showing instead of friendly name after renaming the server
I had to rename a windows 2012 R2 server and after I rename it, Sever is showing SID instead of user friendly name. Even when I try to add new domain group or user in any resourse of this server, the friendly name disappear, soon after I hit apply bu
-
ADF Faces - af:tree - updating nodeStamp components
My tree's nodeStamp is an af:selectBooleanCheckbox which maps to a hierarchy of items of indeterminate depth. There are usually at least 3 levels however. If I toggle a parent checkbox then all the child checkboxes must also toggle to match. That is
-
sap gurus, our scenario is we capture excise invoice then migo(GR) then post excise invoice and then after that miro. In many cases we need to change excise duty in j1iex and then we post excise through j1iex. The changes that we do in excise duty sh
-
Hello all, I have a text file in the following format it has two lines Shop_Evaporator_Item1 Shop_EvaGap_Item1 Shop_Housing_Item1 Shop_EvaPort_Item1 Evaporator EvaGap Housing My aim is to truncate the first line in such a