Insert from Lob to BLOB

How to insert from Lob into blob

Dear User,
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#sthref149
Regards,
Taj

Similar Messages

  • Oracle error ORA-01461when trying to insert into an ORACLE BLOB field

    I am getting Oracle error ‘ORA-01461: can bind a LONG value only  for insert into a LONG column' when trying to insert into an ORACLE BLOB field. The error occurs when trying to insert a large BLOB (JPG), but does not occur when inserting a small (<1K) picture BLOB.(JPG). Any ideas?
    BTW, when using a SQL Server datasource using the same code.... everything works with no problems.
    ORACLE version is 11.2.0.1
    The ORACLE datasource is JDBC using Oracle's JDBC driver ojdbc6.jar v11.2.0.1 (I also have tried ojdbc5.jar v11.2.0.1; ojdbc5.jar v11.2.0.4; and ojdbc6.jar v11.2.0.4 with the same error result.)
    Here is my code:
    <cfset file_mime = Lcase(Right(postedXMLRoot.objname.XmlText, 3))>
    <cfif file_mime EQ 'jpg'><cfset file_mime = 'jpeg'></cfif>
    <cfset file_mime = 'data:image/' & file_mime & ';base64,'>
    <cfset image64 = ImageReadBase64("#file_mime##postedXMLRoot.objbase64.XmlText#")>
    <cfset ramfile = "ram://" & postedXMLRoot.objname.XmlText>
    <cfimage action="write" source="#image64#" destination="#ramfile#" overwrite="true">
    <cffile action="readbinary" file="#ramfile#" variable="image_bin">
    <cffile action="delete" file="#ramfile#">
    <cfquery name="InsertImage" datasource="#datasource#">
    INSERT INTO test_images
    image_blob
    SELECT
    <cfqueryparam value="#image_bin#" cfsqltype="CF_SQL_BLOB">
    FROM          dual
    </cfquery>

    Can't you use "alter index <shema.spatial_index_name> rebuild ONLINE" ? Thanks. I could switch to "rebuild ONLINE" and see if that helps. Are there any potential adverse effects going forward, e.g. significantly longer rebuild than not using the ONLINE keyword, etc? Also wondering if spatial index operations (index type = DOMAIN) obey all the typical things you'd expect with "regular" indexes, e.g. B-TREE, etc.

  • Cannot insert value with : into BLOB field

    I am using Oracle 10g Express Edition.
    Attempting to run this insert from the SQL Commands page:
    INSERT INTO table1 (col1, col2)
    VALUES ('one', '\"2.001:2372.002:002.005:Y2.018:G')
    Table1 info:
    col1 = VARCHAR2(25)
    col2 = BLOB
    After I click Run an Enter Tab Variables appears?
    Is it possible to insert the value straight into col2 without entering bind variables?

    wrong forum

  • How to insert data into the BLOB column

    Hi All,
    Can anyone help me to insert data into the BLOB data type column?
    The table structure is
    CREATE TABLE XXATFL_DM_FORCAST_STG
    TASK_ID NUMBER,
    USER_ID NUMBER,
    CREATED_BY NUMBER(15),
    CREATION_DATE DATE,
    LAST_UPDATED_BY NUMBER(15),
    LAST_UPDATE_DATE DATE,
    LAST_UPDATE_LOGIN NUMBER(15),
    RECORD_STATUS VARCHAR2(1 BYTE),
    ERROR_MESSAGE VARCHAR2(4000 BYTE),
    DATA_FILE BLOB
    I want to insert data in the DATA_FILE column. and this insert statement will in inside a procedure.
    Please help me as soon as possible as this is very urgent for me
    Thanks & Regards,
    Chandan

    i tried like this
    sql> insert into tbl values(1, utl_raw.cast_to_raw('D:\pictures\pic2.bmp'));
    1 record created.
    sql>select * from tbl;
    sp2-0678:Column or attribute type can not be displayed by SQL*PLUS
    sql>
    is this saving only path or bmp file on that path?
    if it is saving bmp file, in which format and how can we retrive it?
    Edited by: user8967883 on Mar 31, 2010 12:57 PM

  • Prevent Duplicates from Inserting from File in Stored Procedure

    CREATE TABLE dbo.Logins
    [ID] numeric(10, 0) NOT NULL Primary Key,
    [Dr_FName] varchar(50) NOT NULL,
    [Dr_LName] varchar(50) NOT NULL,
    [Login] varchar(50) NOT NULL
    GO
    CREATE TABLE [dbo].[CRIS_USER] (
    [id] numeric(10, 0) NOT NULL Primary Key,
    [login_id] varchar(20) NOT NULL
    GO
    CREATE TABLE [dbo].[CRIS_SYSTEM_USER] (
    [id] numeric(10, 0) NOT NULL Primary Key,
    [cris_user_id] numeric(10, 0) NOT NULL,
    INSERT INTO Logins
    (ID, Dr_FName, Dr_LName,Login)
    VALUES(1,'Lisa','Mars','lmars')
    INSERT INTO Logins
    (ID, Dr_FName, Dr_LName,Login)
    VALUES(2,'Becky','Saturn','bsaturn')
    INSERT INTO Logins
    (ID, Dr_FName, Dr_LName,Login)
    VALUES(3,'Mary','Venus','mvenus')
    INSERT INTO CRIS_USER
    (ID,login_id)
    VALUES(10, 'lmars')
    INSERT INTO CRIS_USER
    (ID,login_id)
    VALUES(20, 'bsaturn')
    INSERT INTO CRIS_USER
    (ID,login_id)
    VALUES(30, 'mvenus')
    INSERT INTO CRIS_SYSTEM_USER
    (ID,cris_user_id)
    VALUES(110, 10)
    INSERT INTO CRIS_SYSTEM_USER
    (ID,cris_user_id)
    VALUES(120,20)
    INSERT INTO CRIS_SYSTEM_USER
    (ID,cris_user_id)
    VALUES(130, 30)
    I'm aware that "ID" is a bad column name and that it should not be numeric. The ID columns are incremented by a program. They are not auto incremented. I didn't design it.
    I have a stored procedure that does a bulk insert from a tab delimited file into the three tables:
    CREATE PROCEDURE [dbo].[InsertUserText]
    WITH EXEC AS CALLER
    AS
    IF OBJECT_ID('TEMPDB..#LoginTemp') IS NULL
    BEGIN
    CREATE TABLE #LoginTemp(Login varchar(50),Dr_FName varchar(50),Dr_LName varchar(50))
    BULK INSERT #LoginTemp
    FROM 'C:\loginstest\InsertUserText.txt'
    WITH (ROWTERMINATOR ='\n'
    -- New Line Feed (\n) automatically adds Carrige Return (\r)
    ,FIELDTERMINATOR = '\t'
    --delimiter
    ,FIRSTROW=4)
    PRINT 'File data copied to Temp table'
    END
    DECLARE @maxid NUMERIC(10,0)
    DECLARE @maxid2 NUMERIC(10,0)
    DECLARE @maxid3 NUMERIC(10,0)
    BEGIN TRANSACTION
    SELECT @maxid = coalesce(MAX(ID), 0)
    FROM dbo.LOGINS WITH (UPDLOCK)
    INSERT INTO dbo.LOGINS(ID,Dr_FName,Dr_LName,Login)
    SELECT row_number() OVER(ORDER BY (SELECT NULL)) + @maxid,
    Dr_FName,Dr_LName,Login
    FROM #LoginTemp
    WHERE #LoginTemp.Dr_FName is not Null;
    SELECT @maxid3 = coalesce(MAX(id), 0)
    FROM dbo.CRIS_USER WITH (UPDLOCK)
    INSERT INTO dbo.CRIS_USER(id,login_id)
    SELECT row_number() OVER(ORDER BY (SELECT NULL)) + @maxid3,
    Login
    FROM #LoginTemp
    WHERE #LoginTemp.Dr_FName is not Null;
    SELECT @maxid2 = coalesce(MAX(id), 0)
    FROM dbo.CRIS_SYSTEM_USER WITH (UPDLOCK)
    INSERT INTO dbo.CRIS_SYSTEM_USER(id,cris_user_id)
    SELECT row_number() OVER(ORDER BY (SELECT NULL)) + @maxid2,
    + row_number() OVER(ORDER BY (SELECT NULL)) + @maxid3
    FROM #LoginTemp
    WHERE #LoginTemp.Dr_FName is not Null;
    PRINT 'Copied from Temp table to CRIS_USER'
    COMMIT TRANSACTION
    GO
    What suggestions do you have to prevent a duplicate Logins.Login? None of the inserts for all three tables should occur if a login already exists in the Logins table. There should be a message to indicate which Login failed. I haven't yet decided if I want
    all of the logins in the text file to fail if there is a duplicate, or just the one with the duplicate. I'm open to suggestions on that. So far, the duplicates only occur when someone forgets to update the tabbed delimited file and accidently runs the procedure
    on an old one. I'm sure I can come up with an if statement that will accomplish this. I could maybe use WHERE EXISTS or WHERE NOT EXISTS. But I know I can get a good solution here.
    I'm also aware that duplicates could be prevented in the table design. Again, I didn't design it.
    I have a tab delimited file created but don't see a way to attach it.
    Thanks for any help.

    Thanks to all three that replied. I meant to mark the question as answered sooner. I've tried all the suggestions on a test system. All will work with maybe some slight variations. Below was my temporary quick fix. I'm working on switching to a permanent
    solution based on the replies.
    This is not the real solution and is not the answer to my question. It's just temporary.
    IF OBJECT_ID('TEMPDB..#LoginTemp') IS NULL
    BEGIN
    CREATE TABLE #LoginTemp(Login varchar(50),Dr_FName varchar(50),Dr_LName varchar(50))
    BULK INSERT #LoginTemp
    FROM 'C:\loginstest\InsertUserText.txt'
    WITH (ROWTERMINATOR ='\n'
    Return (\r)
    ,FIELDTERMINATOR = '\t'
    ,FIRSTROW=4)
    PRINT 'File data copied to Temp table'
    END
    DECLARE @maxid NUMERIC(10,0)
    DECLARE @maxid2 NUMERIC(10,0)
    DECLARE @maxid3 NUMERIC(10,0)
    IF EXISTS(SELECT 'True' FROM Logins L INNER JOIN #LoginTemp LT on L.Login = LT.Login
    BEGIN
    SELECT 'Duplicate row!'
    END
    ELSE
    BEGIN
    BEGIN TRANSACTION
    SELECT @maxid = coalesce(MAX(ID), 0)
    FROM dbo.LOGINS WITH (UPDLOCK)
    INSERT INTO dbo.LOGINS(ID,Dr_FName,Dr_LName,Login)
    SELECT row_number() OVER(ORDER BY (SELECT NULL)) + @maxid,
    Dr_FName,Dr_LName,Login
    FROM #LoginTemp
    WHERE #LoginTemp.Dr_FName is not Null;
    SELECT @maxid3 = coalesce(MAX(id), 0)
    FROM dbo.CRIS_USER WITH (UPDLOCK)
    INSERT INTO dbo.CRIS_USER(id,login_id)
    SELECT row_number() OVER(ORDER BY (SELECT NULL)) + @maxid3,
    Login
    FROM #LoginTemp
    WHERE #LoginTemp.Dr_FName is not Null;
    SELECT @maxid2 = coalesce(MAX(id), 0)
    FROM dbo.CRIS_SYSTEM_USER WITH (UPDLOCK)
    INSERT INTO dbo.CRIS_SYSTEM_USER(id,cris_user_id)
    SELECT row_number() OVER(ORDER BY (SELECT NULL)) + @maxid2,
    + row_number() OVER(ORDER BY (SELECT NULL)) + @maxid3
    FROM #LoginTemp
    WHERE #LoginTemp.Dr_FName is not Null;
    COMMIT TRANSACTION
    END
    GO

  • BULK INSERT from a text (.csv) file - read only specific columns.

    I am using Microsoft SQL 2005, I need to do a BULK INSERT from a .csv I just downloaded from paypal.  I can't edit some of the columns that are given in the report.  I am trying to load specific columns from the file.
    bulk insert Orders
    FROM 'C:\Users\*******\Desktop\DownloadURL123.csv'
       WITH
                  FIELDTERMINATOR = ',',
                    FIRSTROW = 2,
                    ROWTERMINATOR = '\n'
    So where would I state what column names (from row #1 on the .csv file) would be used into what specific column in the table.
    I saw this on one of the sites which seemed to guide me towards the answer, but I failed.. here you go, it might help you:
    FORMATFILE [ = 'format_file_path' ]
    Specifies the full path of a format file. A format file describes the data file that contains stored responses created using the bcp utility on the same table or view. The format file should be used in cases in which:
    The data file contains greater or fewer columns than the table or view.
    The columns are in a different order.
    The column delimiters vary.
    There are other changes in the data format. Format files are usually created by using the bcp utility and modified with a text editor as needed. For more information, see bcp Utility.

    Date, Time, Time Zone, Name, Type, Status, Currency, Gross, Fee, Net, From Email Address, To Email Address, Transaction ID, Item Title, Item ID, Buyer ID, Item URL, Closing Date, Reference Txn ID, Receipt ID,
    "04/22/07", "12:00:21", "PDT", "Test", "Payment Received", "Cleared", "USD", "321", "2.32", "3213', "[email protected]", "[email protected]", "", "testing", "392302", "jdal32", "http://ddd.com", "04/22/03", "", "",
    "04/22/07", "12:00:21", "PDT", "Test", "Payment Received", "Cleared", "USD", "321", "2.32", "3213', "[email protected]", "[email protected]", "", "testing", "392932930302", "jejsl32", "http://ddd.com", "04/22/03", "", "",
    Do you need more than 2 rows? I did not include all the columns from the actual csv file but most of it, I am planning on taking to the first table these specfic columns: date, to email address, transaction ID, item title, item ID, buyer ID, item URL.
    The other table, I don't have any values from here because I did not list them, but if you do this for me I could probably figure the other table out.
    Thank you very much.

  • Inserting a filename into BLOB

    There is a lot of talk about inserting a file into BLOB or
    just the file path and storing the file locally. I've decided to
    store the file on the server but what I don't know is how to
    capture that path and file name so I can insert it into the MySQL
    database and later retrieve it when the display page is loaded.
    Also, what is the download side of this? When the page is
    called is there a 'best way' to serve up the file to the user?
    Any sample code for this type of thing would really help me
    get past this sticking point.
    Thank you in advance.
    I'm using a CF8/MySQL 5.x setup. Attached is my upload
    code...

    Bob,
    Thanks for the code, but won't that actually store the
    document in the database rather than just storing the file path? I
    guess I was thinking it would be smarter to store the path in the
    DB rather than the actual file itself. I know this is an invitation
    to a heated discussion as I've found many examples of it here in
    the forums...
    Maybe I'm just misreading the code. And, yes, the intent is
    to store PDF files for the client's app.
    The intent is that when a user visits page 'x' they see a
    short description of a lesson then click on a link to download the
    pdf resource for that particular lesson. Maybe there is a better
    way to do this, I don't know. I'm relatively new at this type of
    situation.
    Thank you for your quick reply!

  • Inserting Image into a BLOB column in Oracle9i

    Hi,
    I am unable to insert image into a BLOB column. I am using Forms 6i REL 2 and Oracle 9i. But I could do it on Oracle 8i with same Forms version.
    Same thing is true for CLOB in 9i.
    Would you please try with this code?
    TABLE
    Create table x
    (Id number,
    Name CLOB,
    Pict BLOB);
    WHEN-BUTTON-PRESSED trigge
    declare
         x varchar2(265);
    begin
         x := get_file_name;
         read_image_file (x, 'GIF', 'picture.pict');
    end;
    Take care,
    Tarek

    Forms 9i and Oracle 9i work fine together for this case.

  • Inserting String data to BLOB column

    Hi All
    I want to insert String data into BLOB column using DBAdapter - through database procedure.
    anybody can help?
    Regards
    Albin Issac

    I have used utl_raw.cast_to_raw('this is only a test')).But for bigger string I get the error as "string literal too long" do we have any similar function for longer string.
    Thanks,
    -R

  • Customizing data insert from

    I have a data insert from that is solely used to insert data in a database. I am trying to figure out a way to customize it such that a few file get auto filled. I use the form to insert data in a table called maintable. 8 of the 10 field of this maintable filled from different vendor's table(currently i manaully put it). What I like to do is see if I can integrate the vendor's table in the page and write codes to autofill the form that put the data in the maintable. I know maybe a while statement will do it. So if in the form  I input vendor's name and product id. it will get the data from vendor's table and relavent product to fill rest of the field. Any guidance will be greatly appreciated as I am very new to web development and don't have much experince in PHP codes.
    Thanks

    Maybe u can try like this. Assuming you have two inputs in form which I have assigned as below
    $product_id = $_POST['pid'];
    $vendor = $_POST['vendor_name'];
    Then do check for vendor name input.
    if(isset($_POST['vendor_name') && !empty($_POST['vendor_name'])) {
    $query = " SELECT * FROM vendor WHERE vendor_name = '$vendor' ";
    $query2 = mysql_query($query, $databaseName) or die(mysql_error);
    $vendor = mysql_fetch_assoc($query2);
    } else echo 'Vendor name doesn't exists';
    $var = $vendor['var'];
    assign for the rest values u want to store in maintable
    //do insert record
    $insert = INSERT INTO maintable .... VALUES ('$vendor', '$var',.....)

  • Acrobat 9 - Document Insert From Scanner

    In Acrobat 9, there needs to be a
    Document > Insert > From Scanner
    Document > Scan to PDF
    is good for creating new documents, but is not suited for quickly scanning and inserting a page into your current PDF. To insert a page, it creates a new document and then requires you to drag and drop the page to the original document. This seems like an unnecessary multi-step process just to insert a page.

    Great post very useful so I have painful to do this with my scanner canon please can you help me

  • Insert from scanner - all menu items grayed out (Acrobat XI)

    I can create documents from the scanner (e.g. Edit > Create > PDF from Scanner), but I cannot insert pages directly from the scanner (e.g. Tools > More Insert Options > Insert from Scanner). Any suggestions why that might be the case?
    I am running Version 11.0.6 on Microsoft Windows 7 Home Premium SP1. The scanner is an HP OfficeJetPro 8500A Plus on my wired LAN.

    I answered my own question. The document into which I was trying to insert a scanned page was signed.

  • Inserting from .txt to table

    Hi all,
    I am trying to insert from text file into the table using the following pl/sql procedure
    everything is working on fine but the table into which i want to insert is not reflecting...
    SQL> create or replace procedure loademployee(
    2 p_filedir in varchar2,
    3 p_filename in varchar2) as
    4 v_filehandle UTL_FILE.FILE_TYPE;
    5 v_newline varchar2(500);
    6 --Input line
    7
    8 v_First_name emp1.first_name%TYPE;
    9 v_last_name emp1.last_name%TYPE;
    10 begin
    11 v_filehandle:=UTL_FILE.FOPEN(p_filedir,p_filename,'r');
    12
    13 insert into emp1(first_name,last_name) values(v_first_name,v_last_name);
    14 UTL_FILE.FCLOSE(v_filehandle);
    15 COMMIT;
    16 EXCEPTION
    17 WHEN UTL_FILE.INVALID_OPERATION THEN
    18 UTL_FILE.FCLOSE(V_FILEHANDLE);
    19 WHEN UTL_FILE.INVALID_FILEHANDLE THEN
    20 UTL_FILE.FCLOSE(V_FILEHANDLE);
    21 RAISE_APPLICATION_ERROR(-20052,'LOADemployee:INVALID FILE HANDLE');
    22 WHEN UTL_FILE.READ_ERROR THEN
    23 UTL_FILE.FCLOSE(V_FILEHANDLE);
    24 RAISE_APPLICATION_ERROR(-20053,'loademployee:READ ERROR');
    25 WHEN OTHERS THEN
    26 DBMS_OUTPUT.PUT_LINE('ERROR OCCURED ' || SQLCODE || ' ' || SQLERRM);
    27
    28 UTL_FILE.FCLOSE(V_FILEHANDLE);
    29 END LOADemployee;
    30 /
    Procedure created.
    SQL> DECLARE
    2 P_FILEDIR VARCHAR2(200);
    3 P_FILENAME VARCHAR2(200);
    4
    5 BEGIN
    6 P_FILEDIR := 'c:\Temp\UTL_FILE';
    7 P_FILENAME := 'test.txt';
    8
    9 SCOTT.LOADEMPLOYEE ( P_FILEDIR, P_FILENAME );
    10 END;
    11 /
    PL/SQL procedure successfully completed.
    SQL> select * from emp1;
    no rows selected

    Pratik.L wrote:
    i just went through the content is the following line used to write text from the content file to the tables into the database
    v_filehandle:=UTL_FILE.fopen(p_filedir, p_filename, 'W');
    Thanks & Regards
    Pratik LakhpatwalaNo, that simply opens the file in the selected mode. It doesn't read or write anything. And your selected mode is "W", which means you are opening the file with the intent of writing to the file, not reading from it. Better go back and read the docs again.
    And as pointed out, you'd be better off using this file as an external table.

  • Batch insert from object variable

    Any way to do this excluding the foreach loop container?  I have millions of rows and if it goes through them 1 by 1 it will take hours maybe days.  How can you do a batch insert from an object variable without putting the sql task inside
    a foreach loop container?
    thanks,
    Mike
    Mike

    I know how to use the dataflow task but it will not work with what I am trying to do as far as I know.  The script I am running is against a netezza box that creates temp tables and then returns a data set that I store in an object variable. 
    I then want to take the data from that object variable and batch insert it into a table.  The only way I can see this being done is by looping through the record set in a foreach loop while mapping the fields to variables and inserting records one
    at a time like I am doing in the screenshot above.  This takes way to long to do.  I am trying to figure out a way to do a batch insert using the data in this object variable.  Is this possible?  I am using SSIS Version
    10.50.1600.1
    thanks,
    Mike
    Hi Mike,
    Provide more details why you cannot use the data flow task for the processing.
    Let me repeat . Loading millions of records in object variable will not work. 
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • Change Insert from File preferences

    Hi folks,
    the default for the Insert from File are set to .pdf and therefore I only see a window with pdf files. Commonly I want to see all files and so I have to change the drop down menu to see ALL FILES.
    Is there a way of permanently changing from .pdf to All Files?
    Thanks you
    Peter

    thanks,
    while it is not a permanent solution it is a reasonable work around - thank you
    Peter

Maybe you are looking for

  • Keep receiving thousands of these emails?

    Hi, I keep getting thousands of these emails to my inbox everyday and I dont know how to stop them, they all look similar to this with some advert attached to it for example:- GOOG NEWS or PEREFT NEWS or AWESOME NEWS or SUPER NEWS with a dodgy link i

  • Time of email shows in Date Column, Date is not showing on new emails

    Date is not showing in Date column. Only time is showing. I just migrated from OE - Old emails show the time & Date.

  • DBMS_LOGSTDBY.SKIP_ERROR  doesn't work

    Hi guru's, I have e a 11.2.0.3 sql-apply dataguard running (prd1 > prd2) and I want to skip grants and revokes on the scott schema.I have done the following (based on the (http://oracledocs.shu.ac.uk/oracle/B28359_01/appdev.111/b28419/d_lsbydb.htm#i9

  • Cannot export to MPEG, MPEG-2, -3, -4, etc.

    Hi, I've searched the forums far and wide and have found some somewhat similar scenarios, but nothing that answers my question.  I'm using Premiere Pro CS4 on a Windows 7 machine.  When I go to export the video, I do not see any options for any MPEG

  • SOA architecture

    hi all experts, Can anyone explain me one business scenario with Service oriented architecture. and some business cases. Thanks Sam