Copy Long raw from oracle table to table

Hi
I am wondering if someone help me to move (copy) long raw data from one table to another. I want to do:
select long_raw_data from table1;
insert into table2 values (previously selected long raw value).
I wrote the following small java code, but it doesn't work. I get the following exception:
java.sql.SQLException: ORA-00936: missing expression.
---------- Code: ---------
import java.net.URL;
import java.sql.*;
class myJDBC
public static void main (String args[])
try {
Class.forName ("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@test:1521:devtest";
Connection con = DriverManager.getConnection (url, "test", "test");
     Statement stmt = con.createStatement ();
     Statement insStmt = con.createStatement ();
ResultSet res = stmt.executeQuery (
"SELECT resume_data FROM resume where rownum < 26 ");
while (res.next ()) {
     byte[] bytes = res.getBytes(1);
     insStmt.executeUpdate("INSERT INTO TMP_RESUME VALUES (" + bytes + ")");
// clean-up
stmt.close ();
con.close ();
catch (Exception e) {
System.out.println (e.getMessage ());
e.printStackTrace ();
------------ Code ends ---------------
Thanks for your help
V Prakash

use PreparedStatement :
PreparedStatement insStmt = connect.prepareStatement("INSERT INTO TMP_RESUME VALUES (?)");
while (res.next ())
byte[] bytes = res.getBytes(1);
insStmt.setBytes(1,bytes);
insStmt.executeUpdate();
I don't remember very querys with ORACLE,
but you may be do this in one time with
SELECT ...... INTO ....
or
INSERT ..... INTO ..... SELECT
One of this is valid for ORACLE and the other for SYBASE ...

Similar Messages

  • Copying Long Raw Column Data to another table

    hi everyone,
    i am trying to Copy Long Raw Column Data to another table in the same schema. this is the situation
    Table A (col1 number,col2 long raw) with 100 records
    Table B (col1 number,col2 long raw) with 0 records
    now i want to copy col2 of the table A into the column 2 of the table B. but long raw data cant be retrieved in a select statement so is there any specific procedure that will copy long raw data or there is any simple way.
    i will be really grateful for anybody's help.
    thanx
    shakeel

    Dust off that old SQL*PLUS command "COPY" ...
    create table tablea (col1 number,col2 long raw)
    insert into tablea values (1, testrawio.chartoraw('this is line one'));
    insert into tablea values (2, testrawio.chartoraw('this is line two'));
    insert into tablea values (3, testrawio.chartoraw('this is line three'));
    create table tableb (col1 number,col2 long raw)
    copy from scott/tiger@larry insert tableb (col1, col2) using select col1, col2 from tablea
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
       3 rows selected from scott@tiger.
       3 rows inserted into TABLEB.
       3 rows committed into TABLEB at DEFAULT HOST connection.
    SQL>Now to prove it has worked :
    begin
       for lr in (select col1, col2 from tableb)
       loop
          dbms_output.put_line('col1 = '||lr.col1||
                               ' and col2 contains long raw equivalent of '||testrawio.rawtochar(lr.col2));
       end loop;
    end;
    col1 = 1 and col2 contains long raw equivalent of this is line one
    col1 = 2 and col2 contains long raw equivalent of this is line two
    col1 = 3 and col2 contains long raw equivalent of this is line three
    PL/SQL procedure successfully completed.
    SQL> Note : In order to load some test data and prove the method works I made use of a package called "testrawio" located at http://www.classicity.com/oracle/htdocs/forums/ClsyForumID125/7.html
    AMM

  • Copy Long Raw from table 1 to another table in Oracle 8i

    I have 2 similar tables in Oracle 8i.
    Table 1:
    Id number;
    blob_obj long raw;
    Table 2:
    Table 1:
    Id number;
    blob_obj long raw;
    Is there any way to copy the data from table to table 2 ?
    Is it possible to do some conversions are load it ?
    Kindly provide pointers for this issue.

    See this thread Re: Getting LONG RAW from remote database for some useful ideas.
    Regards Nigel

  • Copy Long raw from one table to another.

    Hi
    I am trying to copy data from one table to another. Source has one Long Raw column. There are about million rows in source table. And I am using Oracle 8.1.5. Whenever I execute the copy command, I get the following error message: Can someone help me?
    SQL> set long 64000000
    SQL> set copycommit 1
    SQL> set arraysize 100
    SQL> COPY to test/test@testfix CREATE resume_bkup1 using select * from resume;
    Array fetch/bind size is 100. (arraysize is 100)
    Will commit after every array bind. (copycommit is 1)
    Maximum long size is 64000000. (long is 64000000)
    ERROR:
    ORA-01084: invalid argument in OCI call
    SQL>
    Thanks
    V Prakash

    insert into emp_personal(emp_no, emp_pic) select emp_no, emp_pic from emp_personal_old where empno = '10059'
    Read the documentation as suggested by sol.beach.
    And fix your front-end to use supported datatypes.

  • How do I get LONG RAW from Oracle with ASP page designed in Dreamweaver

    Hello,
    I have a single entry field the user enters a SSN to search a database, the query searches one table which returns the data.
    Unfortunately one of the fields in the table is a LONG RAW field.
    How do I create the ASP page to display the LONG RAW data correctly?
    Thanks,
    Adam

    You can use XSU with Oracle 8.1.6:
    xsu12_816.jar: for Java 1.2
    xsu111_816.jar: for Java 1.1
    Please refer to the following link to download the XDK for Java:
    http://otn.oracle.com/software/tech/xml/xdk_java/content.html
    For XSU document:
    http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Producti
    on9i/java/xsu/readme.html
    XSU provide both JAVA and PL/SQL APIs.

  • How to copy the Data From Oracle Table To SAP Table

    Hi Friends,
    We need to copy the data from Oracle Database Table to SAP Table. The data should be updated simultaneously in both tables . Should I write a program that contains the native sql statement like EXEC SQL PERFORMING WRITE,....
    I appreciate any suggestions regarding this.
    Regards
    CSM Reddy

    Hi,
    since you posted this question in the DB2 forum I assume that you are using a DB2 database for your SAP system.
    To access a table from a legacy ORACLE database you may use the DBSL multiconnect feature. I.e. you open a secondary connecction in the SAP system to your ORALE database. You can then ready the data from the ORACLE database into an ABAP internal table and insert it afterwards into the DB2 table on the main connection.
    Another way to access an ORACLE table from a DB2 database is to use the DB2 federated database feature. This requires a little bit more DB2 skill. With this feature you can make the ORACLE table visible within the DB2 database. To copy data you can then simply use a "INSERT ... SELECT" statement. 
    Regards
             Frank

  • Getting LONG RAW from remote database

    Hi,
    I have a table in my local database that has a LONG RAW column . I have another table of similar structure in a remote database (so it has LONG RAW as well). I would like to transfer data including LONG RAW data from the remote database into the local database table using PL/SQL. I know it is not possible to copy LONG RAW over dblink directly. Can anyone suggest an approach to accomplish this?
    The local table cannot be changed to BLOB, but I have the flexibility to change the remote table to use BLOB. So, can anyone tell me if the following solution would work. If so, can you shed some light on what PL/SQL libraries to use or can you provide me with some sample code to implement steps 3 and 4 below?:
    1. Change the remote table to use BLOB
    2. Create a new temporary table with BLOB in the local database.
    3. Copy data using PL/SQL from remote BLOB to local temporary table BLOB.
    4. Copy data using PL/SQL from BLOB to LONG RAW within the local database from temporary table (w/ BLOB) to the actual target table (w/ LONG RAW).
    I think step 3 can be a direct Insert-Select from remote table (I'll try this myself), but not sure how to go about step 4.
    Thanks for your help.

    There is a chapter in the Oracle Application Developer's Guide on calling external procedures
    I don't know enough about VB and the available VB APIs to know for sure. I would assume that VB could be configured to generate a DLL with a C call specification. I would also assume that there was a VB API that would allow you to manipulate LONG RAW and BLOB data. Unfortunately, though, I don't know which VB API's have that functionality.
    Justin

  • Copying SQL Script from Oracle SQL Developer into Excel with formatting

    I need to copy a SQL Script into Excel in order to develop some VBA code. Is there any nice way that I can copy SQL Script from Oracle SQL Developer into Excel and retain its formatting? I am a stickler for having legible, readable SQL and like to have all my columns lined up and aliases lined up. When we used to use SQL Navigator, the tab formatting seemed to copy and paste just fine. Now that we have migrated to Oracle SQL Developer, the formatting seems to get all messed up.
    And suggestions are greatly appreciated and Thanks in advance for your review and am hopeful for an answer.
    Thanks.
    PSULionRP

    I suppose you want a real tabulator instead of spaces. You can configure this in the preferences (SQL Formatter - Oracle). You have to apply it then to your existing code (e.g. CTRL-F7), but new code should get it right from the start.
    Hope that helps,
    K.

  • Copying long raw to other table??

    Hi everyone....
    I'm using oracle 10g.
    In my table i have a LONG RAW column to store images.
    Now i need to copy the data in LONG RAW to another table...
    Is this possible.. if yes then whats the procedure to copy the data from LONG RAW ??
    please help me in this query.....
    its very urgent.......
    is it possible using oracle 8i ??
    Thanks in advance....
    Regards,
    Santosh.Minupurey
    Edited by: Santosh.minupurey on Feb 16, 2009 11:23 PM

    No one could answer my query ?
    very strange......

  • Moving Long Raw from one table to another

    How to copy the record stored in a table which has Long Raw column and insert into another table
    The follwoing code is giving a numeric or value error
    declare
    BLOB_ID NUMBER(12);
    BLOB_FILE LONG RAW;
    Cursor c1 is select
    BLOB_ID ,
    BLOB_FILE from test ;
    Begin
         Open c1;
         Loop
         Fetch c1 into
         blob_id,
         blob_file;
         Exit when c1%notfound;
         End loop;
         Close c1;
    End;

    I don't see any problem with your code. Are you sure that the type of your variables matches the datatypes of blob_id and blob_file?
    sql>create table test (blob_id number(12), blob_file long raw);
    Table created.
    sql>create table test_copy (blob_id number(12), blob_file long raw);
    Table created.
    sql>insert into test values (1, utl_raw.cast_to_raw(lpad('x', 40, 'x')));
    1 row created.
    sql>declare
      2    blob_id    test.blob_id%type;
      3    blob_file  test.blob_file%type;
      4    cursor c1 is
      5      select blob_id, blob_file from test;
      6  begin
      7    open c1;
      8    loop
      9      fetch c1 into blob_id, blob_file;
    10      exit when c1%notfound;
    11      insert into test_copy values (blob_id, blob_file);
    12    end loop;
    13    close c1;
    14    commit;
    15  end;
    16  /
    PL/SQL procedure successfully completed.
    sql>select * from test_copy;
      BLOB_ID B
            1 7

  • How tu update a column having type 'Long raw' in oracle table with an image

    Hello,
    I must change the image loading in a column with 'long raw' type in the table. I find an image data already in the table.
    I have my new imgae in a file .bmp.
    What SQL instruction I mut use to update this column to load my new image ?
    I work in Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod.
    thanks for your helps.
    Regards.

    Unless I'm missing something MSFT are making it unecessarily complex by not implementing the SQL/XML standard...
    SQL> alter table emp add ( emp_xml xmltype)
      2  /
    Table altered.
    SQL> update emp set emp_xml = XMLELEMENT("EMPLOYEE",xmlattributes(EMPNO as "id"), XMLElement("Name",ENAME))
      2
    SQL> /
    14 rows updated.
    SQL> set pages 0
    SQL> select EMPNO, EMP_XML from EMP
      2  /
          7369
    <EMPLOYEE id="7369">
      <Name>SMITH</Name>
    </EMPLOYEE>
          7499
    <EMPLOYEE id="7499">
      <Name>ALLEN</Name>
    </EMPLOYEE>
          7521
    <EMPLOYEE id="7521">
      <Name>WARD</Name>
    </EMPLOYEE>
          7566
    <EMPLOYEE id="7566">
      <Name>JONES</Name>
    </EMPLOYEE>
          7654
    <EMPLOYEE id="7654">
      <Name>MARTIN</Name>
    </EMPLOYEE>
          7698
    <EMPLOYEE id="7698">
      <Name>BLAKE</Name>
    </EMPLOYEE>
          7782
    <EMPLOYEE id="7782">
      <Name>CLARK</Name>
    </EMPLOYEE>
          7788
    <EMPLOYEE id="7788">
      <Name>SCOTT</Name>
    </EMPLOYEE>
          7839
    <EMPLOYEE id="7839">
      <Name>KING</Name>
    </EMPLOYEE>
          7844
    <EMPLOYEE id="7844">
      <Name>TURNER</Name>
    </EMPLOYEE>
          7876
    <EMPLOYEE id="7876">
      <Name>ADAMS</Name>
    </EMPLOYEE>
          7900
    <EMPLOYEE id="7900">
      <Name>JAMES</Name>
    </EMPLOYEE>
          7902
    <EMPLOYEE id="7902">
      <Name>FORD</Name>
    </EMPLOYEE>
          7934
    <EMPLOYEE id="7934">
      <Name>MILLER</Name>
    </EMPLOYEE>
    14 rows selected.
    SQL>

  • Copy long text from PROJ to WBS

    When creating a new project (CJ01) I create new WBS and populate its fields from project automatically.
    I use enhancement and everything is copying ok except the long text.
    I do READ_TEXT and it get long text from project (TEXT_HEADER-TDNAME D99999999)
    Then i do SAVE_TEXT and not getting any error  (TEXT_HEADER-TDNAME E99999999)
    But the long text of WBS is empty.
    How should i copy long text right?
    I traced program and found out that after my enhancement is passed,
    WBS element is not activated and rewrited by initial data from PRPS-POST1
    How should i activate wbs then?
    Thank you for help!

    Hello,
    That code can help you If the text not exist.
    be carreful, that code have not declaration
    Thierry
    CALL FUNCTION 'NUMBER_GET_NEXT'
                EXPORTING
                  nr_range_nr = '01'
                  object      = 'PSTX'
                IMPORTING
                  number      = wl_name.
              ws_prtx-prmandt = sy-mandt.
              ws_prtx-probtyp = 'E'.
              ws_prtx-prpspnr = wv_posnr.
              ws_prtx-prtxtky = wl_name.
              APPEND ws_prtx TO wt_prtx.
              CALL FUNCTION 'CJVB_PRTX_POST'
                TABLES
                  tinsert = wt_prtx
                  tdelete = wt_d_prtx
                  tupdate = wt_u_prtx.
              ws_pstx-psmandt = sy-mandt.
              ws_pstx-pstxtky = wl_name.
              ws_pstx-pstxtar = '03'.
              ws_pstx-pstxtti = 'COMMENTAIRES'.
              ws_pstx-pstxthu = p_uname.
              ws_pstx-pstxthd = sy-datum.
              ws_pstx-pstxtau = p_uname.
              ws_pstx-pstxtad = sy-datum.
              ws_pstx-psformat = ''.
              APPEND ws_pstx TO wt_pstx.
              CALL FUNCTION 'CJVB_PSTX_POST'
                TABLES
                  tdelete = wt_d_pstx
                  tinsert = wt_pstx
                  tupdate = wt_u_pstx.
              IF sy-subrc = 0.
                wl_object = wc_obtxt.
                wl_id = wc_idtxt.
                wl_spras = sy-langu.
                ws_head-tdobject = wl_object.
                ws_head-tdname = wl_name.
                ws_head-tdid = wl_id.
                ws_head-tdspras = wl_spras.
                CALL FUNCTION 'SAVE_TEXT'
                  EXPORTING
                    client          = sy-mandt
                    header          = ws_head
                    insert          = ' '
                    savemode_direct = 'X'
                  TABLES
                    lines           = wt_tline
                  EXCEPTIONS
                    OTHERS          = 1.

  • 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

  • Insert image to long raw column Oracle 9i PL/SQL

    I am trying to insert a .jpg image into an Oracle 9i table datatype long raw. I am coding in PL/SQL. I have researched inserting images and all I get back is the cool dbms_lob utility info. I cant change the column type to a blob - the database is a people soft delivered table and I am not allowed to change it.
    Has anyone done this?
    Does anyone have sample code?
    Pretty Please (I need any help I can get)
    Kelli

    user10506010 wrote:
    Can u provide me a solution for this...Can you read the title of this forum?
    >
    Forum: Community Feedback and Suggestions (Do Not Post Product-Related Questions Here)
    Use this forum for feedback about OTN programs, Web site content, and systems - product-related questions will be deleted.

  • Copy and Paste from Oracle Forms to Excel

    Hi to All,
    I ran into this unusal problem with one user. She is trying to copy data in a cell from oracle form to excel. She does control+c and tries to control+v in excel. The data does not get pasted.
    I tried logging into oracle on her pc and do the same method. I get the same results.
    We tried copy from the menu bar in oracle and go into excel , menu and do paste. And it does not paste.
    I did a test from copy from word document to excel...that worked.
    We tried a different pc and everything worked.
    Is there a setting in oracle when i do a copy that is not copyin the cell correctly. Any tips how to resolve this problem.
    Thanks in advance for help in this matter.

    If it only happens on one PC, then usually there is a problem with the PC showing the "yellow bars" when logging into Oracle Forms. Otherwise, there is a more global problem with unsigned JAR files on the server.
    Unable To Copy And Paste Text To Desktop Applications From Core Applications
    http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=434038.1
    Cannot Cut, Copy, or Paste from a Desktop Application into Oracle Applications
    http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=168280.1
    Cannot Perform a Copy and Paste from release 12.0.4 from or to Excel
    http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=735670.1

Maybe you are looking for

  • Is there a gorilla glass 2 on macbook pro retina display?

    hi there, like a month ago i bought a Macbook pro Retina, and I have been asking myself or there is a gorilla glass 2 on macbook pro retina display? cheers, Joseph

  • Existing Pernr bank details is updated in PRAA program

    Hi Guys, i am changing the existing personal number bank details in PA30 infotype 0005 for these changes will updated vendor master records through PRAA?. In PRAA if I change the personal details in PA30 will it update the Vendor master records same

  • Advice needed on move to in-house email. DNS and subdomain newbie.

    Hi there. One of my hats says IT Manager and I have a decision to make regarding about email services for a fast growing company. At present my company uses MediaTemple to host our web and email, but are presently finding many limitations particularl

  • {code} in Plain Text Help

    A lot of the answers are reminding people to use the {noformat}{noformat} tag. The use of that tag could be encouraged by adding {noformat}{noformat} to the "Plain Text Help" section that appears on the right during posting. Has that been tried?

  • Logic crashes on entering 'controller assignments' window

    Hi, I hope someone can help me with this. When I want to enter the controller assignments window in the preferences menu, Logic Pro 7.1 crashes, telling me it will save the song I'm working on. I want to assign controllers to use my Novation ReMOTE S