Extracting info out of a long raw

I have a table (actually from the Peoplesoft financials system) with a field type of :-
MIMEDATALONG LONG RAW()
This field contains an XML document, I'm trying to extract the XML out of the field using SELECT.
I've tried every function I know of, but each one results in a ORA-00997 Invalid use of LONG datatype.
Any suggestions? (All my attempts are below)
select MIMEDATALONG, utl_raw.convert(MIMEDATALONG)
from sysadm.psapmsgpubdata
where pubnode = 'RMAX' and chnlname ='RI_JOBORDER_MSG_CHNL' and pubid = 862;
select MIMEDATALONG, utl_raw.substr(MIMEDATALONG,1,100)
from sysadm.psapmsgpubdata
where pubnode = 'RMAX' and chnlname ='RI_JOBORDER_MSG_CHNL' and pubid = 862;
select MIMEDATALONG, utl_encode.uudecode(MIMEDATALONG)
from sysadm.psapmsgpubdata
where pubnode = 'RMAX' and chnlname ='RI_JOBORDER_MSG_CHNL' and pubid = 862;
select MIMEDATALONG, utl_encode.mimeheader_decode(MIMEDATALONG)
from sysadm.psapmsgpubdata
where pubnode = 'RMAX' and chnlname ='RI_JOBORDER_MSG_CHNL' and pubid = 862;
select MIMEDATALONG, utl_encode.quoted_printable_decode((MIMEDATALONG)
from sysadm.psapmsgpubdata
where pubnode = 'RMAX' and chnlname ='RI_JOBORDER_MSG_CHNL' and pubid = 862;
select MIMEDATALONG, utl_encode.base64_decode(MIMEDATALONG)
from sysadm.psapmsgpubdata
where pubnode = 'RMAX' and chnlname ='RI_JOBORDER_MSG_CHNL' and pubid = 862;
select MIMEDATALONG, utl_raw.CAST_TO_VARCHAR2(MIMEDATALONG)
from sysadm.psapmsgpubdata
where pubnode = 'RMAX' and chnlname ='RI_JOBORDER_MSG_CHNL' and pubid = 862;
select MIMEDATALONG, dbms_lob.substr(MIMEDATALONG,1,50)
from sysadm.psapmsgpubdata
where pubnode = 'RMAX' and chnlname ='RI_JOBORDER_MSG_CHNL' and pubid = 862;

Write a procedure using DBMS_SQL and UTL_FILE packages to get the output into a flat file.

Similar Messages

  • Help: Extract OLE object from 8i (long raw) to a server file folder

    Posting here because most of the technical discussion I have found are in this group (Forms).
    I have an 8i db with workpapers(.doc,.xls,etc) stored in a Long Raw column wrapped in OLE that were collected using forms. The DB is maintained on a Sun Solaris platform.
    I need to extract the documents and write each one to a server folder as a .doc or ,xls without any OLE details.
    Is this possible? How?

    As far as I know you have to use OLE Item to work with the information. Unfortunately there is not any standart way to extract a source document from OLE. Some applications such as Word, Excel support OLE Automation, so you could use OLE2 package to save the document as a file, that is the easest way. But others don't, so you may have to use an undocumented way to extract a document.
    Take a look at the following thread:
    Subj: 6i to 9i Ole to LOB translations, How do you know the App. server?
    Re: 6i to 9i Ole to LOB translations, How do you know the App. server?
    P.S. If you can't extract some types of your documents, please let me khow.
    P.P.S. To extract a document through OLE2 package you could use something like the following. /I'm not sure the code is correct/:
    DECLARE
    handle ole2.obj_type;
    BEGIN
    ACTIVATE_SERVER('OLE1');
    handle := forms_ole.get_interface_pointer('OLE1');
    BEGIN
    -- Save a document to disk
    Args :=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(Args, 'C:\test.doc'); -- file name
    OLE2.INVOKE(handle, 'SaveAs', Args);
    OLE2.DESTROY_ARGLIST(Args);
    EXCEPTION WHEN OTHERS THEN
    Message('Error');
    END;
    -- OLE2.RELEASE_OBJ(handle);
    END;

  • [ORACLE 10G] Extract Long Raw data to disc

    Hi All,
    I want to extract a column which contain long raw data (pdf file) into files on my disque, but i don't know how to do it in SQL or PL/SQL, any help ???

    Or maybe just an alter table statement will do it for you...
    SQL> create table xx (x long raw);
    Table created.
    SQL> desc xx;
    Name                                                                   Null?    Type
    X                                                                               LONG RAW
    SQL> alter table xx modify (x blob);
    Table altered.
    SQL> desc xx;
    Name                                                                   Null?    Type
    X                                                                               BLOB
    SQL>I've not really used LONG RAW's before but apparently (according to sources on the net) the simlple alter table statement above will do the job.

  • How to get image out from LONG RAW from the database

    Dear fellow Oracle users
    I have a table about 50,000 rows one of the the column is LONG RAW.. and we store image files within this column ... almost 99% is gif format.
    Does anyone able to recommand a way to get ALL these images out of the database and save it into a directory. May be a batch process or may be some kind of tools?
    Not all the rows consists of images (i.e some of the the long raw can be null for some row) .
    Any sample codes are very much appreciated...(I am okay with PL/SQL , a little rusty with Java coding but okay to pick it up again...)
    regards
    Ivan

    Hi,
    if u are using oracle forms than u can integrate Webutil with it, there are many function available within webutil to do this.
    Thanks

  • Extracting LONG RAW's (Off Topic)

    Hi all,
    Do you know of any function/SQL to extract a LONG RAW to a file
    from the Oracle Server 8.0.5 Linux?
    I.e. I've got records with an ID and a LONG RAW containing binary
    data. I want to export the binary data to a file on then
    server with the same name as the record ID.
    Sorry if this is a bit off-topic but no one else seems to
    know if it's even possible ...
    TIA, Ben.
    null

    Ben Cant (guest) wrote:
    : Hi all,
    : Do you know of any function/SQL to extract a LONG RAW to a file
    : from the Oracle Server 8.0.5 Linux?
    : I.e. I've got records with an ID and a LONG RAW containing
    binary
    : data. I want to export the binary data to a file on then
    : server with the same name as the record ID.
    : Sorry if this is a bit off-topic but no one else seems to
    : know if it's even possible ...
    : TIA, Ben.
    We use perl to do this and it works ok.
    Regards,
    Michael.
    null

  • Extracting Tiff files stored into Oracle 8.1.7 as Long Raw

    I have around 1 million tiff images stored into Oracle 8.1.7. The field type is Long Raw. The frontend used to store images into the database is SQL Windows 5 from Gupta Corporation, now called Centura. I guess the images are stored in binary format in the database. I need to extract these images at the OS level. Each Rec_no contains one tiff file in database. The table structure is as follows:
    Rec_no Number(8)
    image Long Raw
    My goal is to convert these tiff files to JPG files so that my web application written in ASP.Net can use them and show in IE. The files are required to be converted to jpg as IE does not have native support for showing the tiff files(I hope I am not wrong in this assumption). Can i convert these tiffs to jpg directly inside the oracle database??? or i need to extract them first, save at OS level, convert them and then write back to the database?? Pls give code examples if possible. I plan to migrate the database also from 8i to 10g shortly and this is one of the migration taks. Thanks in advance...
    Ravinder Hooda

    I have around 1 million tiff images stored into Oracle 8.1.7. The field type is Long Raw. The frontend used to store images into the database is SQL Windows 5 from Gupta Corporation, now called Centura. I guess the images are stored in binary format in the database. I need to extract these images at the OS level. Each Rec_no contains one tiff file in database. The table structure is as follows:
    Rec_no Number(8)
    image Long Raw
    My goal is to convert these tiff files to JPG files so that my web application written in ASP.Net can use them and show in IE. The files are required to be converted to jpg as IE does not have native support for showing the tiff files(I hope I am not wrong in this assumption). Can i convert these tiffs to jpg directly inside the oracle database??? or i need to extract them first, save at OS level, convert them and then write back to the database?? Pls give code examples if possible. I plan to migrate the database also from 8i to 10g shortly and this is one of the migration taks. Thanks in advance...
    Ravinder Hooda

  • URGENT - Extract Image Files From Long Raw Column

    Hi.
    I have to extract image files (tif and wmf format) from "long raw" column and put them in a directory, using a PL/SQL procedure.
    Can anyone help me.
    Thanks

    Well that is interesting, that ORA returns no records on Metalink. Anyway, that was for my own curiosity.
    As you are on 10g, this is how I would write a long raw to a file if I had no choice:
    1) create a gtt with a column of type blob
    2) insert into the gtt the long raw column using the to_lob conversion function
    3) you now have a lob!
    4) open a binary file for writing using utl_file (binary mode was introduced in 10g)
    4) use dbms_lob to read through the blob and write it in chunks to the file
    You will have to do this row by row. It will be painfully excrutiatingly slow.
    This is basically your only choice unless you have a OCI programmer to hand. In which case I would be getting them to write the C code to read the long raw column and write it to a file. This could then be compiled into a library and called as an external procedure from PL/SQL.
    HTH
    Chris

  • 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

  • Xmlgen.getxml Nested Cursors with LONG RAW and BLOB Data Types

    I am trying to use a nested cursor with xmlgen.getxml that has a long raw or blob column. In either case, it will not return to me any data in the xml document pertaining to that LONG RAW or BLOB column. If I do not use a nested cursor, it works fine.
    Example:
    SELECT xmlgen.getxml('SELECT x, CURSOR(SELECT y FROM y_tab WHERE y_tab.x_id = x_tab.x_id) y FROM x_tab') FROM dual;
    This will not produce the information I am after.
    However, simply running:
    SELECT xmlgen.getxml('SELECT y FROM y_tab WHERE y_tab.x_id = <somevalue>') FROM dual;
    Works???
    Any ideas out there? Does anyone know if DBMS_XMLQUERY has this limitation?
    Thanks,
    Brad

    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

  • 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.

  • HOW TO RETRIEVE A LONG RAW COLUMN FROM A TABLE AND WRITE TO OS FILE

    Good evening.
    Please how can I read a long raw datatype from a table and insert into an operating system file using PL/SQL.
    Thank you.

    What does this have to do with LONG RAW? It is about UTL_FILE and not especially great code.
    The question is how to retrieve and write LONG RAW and that is quite a different matter.
    First you must convert it to BLOB.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:13213885403654
    Then you can write it out to the file system
    http://www.morganslibrary.org/reference/utl_file.html
    Look at the "Extract Blob" demo

  • Long Raw

    I need to set up a table with a Long RAW field, to store images. I have had a look round and found lots of info about Long RAW, how to view it etc but nothing on how to get data in.
    I can see that C++ or Java code can be used, but is there anything Oracle provides to simply 'pipe' in a file? This is initially for a simple test and I just need to get something in quickly. Thanks.

    This isn't what you are asking but ...
    If you're on 9i+, I strongly suggest using a BLOB instead of a LONG RAW. You can do things with BLOBs (mostly through the DBMS_LOB package) that you can't do with LONG RAWS. Essentially all you can do with LONG values is put a value in and get it back out again. with a lot of work if its > 32K.
    I'm not aware of any way to, as you put it, "'pipe' in a file". Hopefully somebody else can advise on the best way to get a BLOB in.

  • Reading and Inserting Value in Long Raw

    Hi guys !!
    I have a table with 15 columns out of which RESUME column has data type long Raw. I want to copy this table to another table with selectd columns and validation. I want to check whether RESUME column is NULL. How to achieve it ?
    Similarly, using VB how to insert and retrieve values in such column ?
    thanx in advance
    Abhi

    do one thing ,
    Create a summary item for detail amount column, say m_tot_amt
    Set its fol. properties
    Calculation Mode : Summary
    Summary : Sum
    Summ.Blk : Your detail blk
    Summ. Item : Your detail amount item
    Also, Set Query all records of your detail block as Yes
    Then In PRE-INSERT/ PRE_UPDATE of detail block, write
    :COP_ORDER_HEADER.DISCOUNT_AMOUNT := nvl(:m_tot_amt,0) ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • HT1725 How do I delete credit card info there is no longer a none option

    How do I delete credit card info there is no longer a none option

    I am having the same problem and was wondering if you ever found out how to delete the credit card info and not just change it??

  • How can i read a stored picture in oracle Long Raw datatype? blob or clob?

    How can i read a stored picture in oracle Long Raw datatype? Like a blob or clob?....i am using jdk 1.3
    This is because...i tried to read it like a blob but i obtain a exception...about Type of column no valid......but the column exist....and it contains the long raw datatype of the pictures.....this is my code:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.BLOB;
    import oracle.sql.BLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    class rec_ima1
    public static void main(String h[])
    Connection con = null;
    Blob bl;
    final ImageIcon image1;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    if (!rs.next())
    System.out.println("Empty Result Set");
    bl = rs.getBlob(5);
    if (bl == null) {
    System.out.println("Null Blob");
    return;
    InputStream is = bl.getBinaryStream();
    int imageLength = (int) bl.length();
    System.out.println(imageLength);
    System.out.println(bl.length());
    byte[] imageData = new byte [imageLength];
    is.read(imageData, 0, imageLength);
    image1 = new ImageIcon(imageData);
    photo = new JPanel() {
    public void paint(Graphics g){
    g.setColor(Color.lightGray);
    g.drawImage(image1.getImage(), 0, 0, this);
    } catch (Exception e) {
    e.printStackTrace();
    Now i tried using clob:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.CLOB;
    import oracle.sql.CLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.CallableStatement;
    class rec_ima4
    public static void main(String h[])
    Connection con = null;
    Clob cl;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    con.setAutoCommit (false);
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    while (rs.next()) {
    oracle.sql.CLOB clob = (CLOB) rs.getObject(5); //line 47
    } catch (Exception e) {
    e.printStackTrace();
    This is the runtime exception:
    java.lang.ClassCastException: [B
    at rec_ima4.main(rec_ima4.java:47)

    Thanks by answering to me......
    Well....i did that....but what is ImageIO?....
    I declared a ImageIcon imageIO, but this give me the following:
    rec_ima3.java:49: cannot resolve symbol
    symbol : class BufferedImage
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    rec_ima3.java:49: cannot resolve symbol
    symbol : variable ImageIO
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    What classes i have to import?.....what is ImageIO?
    Thanks

Maybe you are looking for

  • Adobe products under OS X and Win XP

    Can anyone give me a comparison of the performance of Photoshop,etc. when running them under OS X and Win XP (boot camp of course on the same machine). I'm assuming CS2. Just raw performance...I will have to factor in the time I would save using the

  • Vendor master update for Payment methods at MASS t.code

    Hi friends, Iam changing one new payment method to all vendors (600). for this updates iam using MASS t.code.but iam confuging this step. please help me how to do it at mass t.code step by step. it is very urgent. Advance Thanks Raj

  • When clicking "Send for Signature" how do I get it to open in EchoSign first so I can place signature fields?

    It seems Acrobat Pro XI recently updated and now when I chose to send for signature via echo sign, it just ships the doc off to the recipient willy-nilly with out asking what other fields I may want input, where I may want to sign myself (upon first

  • Problem in Creating Sales Order PL/SQL API

    Hey, I've to create a Sales Order 'n BPEL by using Apps Adapter. In Module Browser, I've chosen the OE_ORDER_PUB.PROCESS_HEADER and given the correct details. I passed the new ORDER_NUMBER and HEADER_ID as blank. I'm getting the response RETURN_STATU

  • System recovery error in satellite A300

    Hi. Sorry for the bad english. I have a problem. In my satellite A300 Vista comes a blue screen error. I followed the instructions in the manual to make system recovery. At the boot press f8 and select "Repair your computer". Seems to start properly