Inserting blob in a table: problems

I wanted to insert a picture into the database using PLSQL table. Please let me know if the image file must be on a database server or I can insert it premises as well. Please find below my code and the error I get.

Call to the procedure and the error
BEGIN
load_blob_from_file
( 'D:\PRoJeCt-RS\OracleError', 'item', 'item_blob',  'id', '2');
END;

BEGIN
*
ERROR at line 1:
ORA-22285: non-existent directory or file for FILEEXISTS operation
ORA-06512: at "SYS.DBMS_LOB", line 504
ORA-06512: at "CMSRTPGM.LOAD_BLOB_FROM_FILE", line 18
ORA-06512: at line 2
My procedure to insert data into the table
CREATE OR REPLACE PROCEDURE load_blob_from_file
( src_file_name     IN VARCHAR2
, table_name        IN VARCHAR2
, column_name       IN VARCHAR2
, primary_key_name  IN VARCHAR2
, primary_key_value IN VARCHAR2 ) IS
  -- Define local variables for DBMS_LOB.LOADCLOBFROMFILE procedure.
  des_blob      BLOB;
  src_blob      BFILE := BFILENAME('GENERIC',src_file_name);
  des_offset    NUMBER := 1;
  src_offset    NUMBER := 1;
  -- Define a pre-reading size.
  src_blob_size NUMBER;
  -- Define local variable for Native Dynamic SQL.
  stmt VARCHAR2(2000);
BEGIN
  -- Opening source file is a mandatory operation.
  IF dbms_lob.fileexists(src_blob) = 1 AND NOT dbms_lob.isopen(src_blob) = 1 THEN
    src_blob_size := dbms_lob.getlength(src_blob);
    dbms_lob.open(src_blob,DBMS_LOB.LOB_READONLY);
  END IF;
  -- Assign dynamic string to statement.  -- We are going to obtain the clob locator (pointer) to use later 
  stmt := 'UPDATE '||table_name||' '
       || 'SET    '||column_name||' = empty_blob() '
       || 'WHERE  '||primary_key_name||' = '||''''||primary_key_value||''' '
       || 'RETURNING '||column_name||' INTO :locator';
  -- Run dynamic statement.  -- the locator (pointer) to the blob will assigned to des_blob   
  EXECUTE IMMEDIATE stmt USING OUT des_blob;
  -- Read and write file to BLOB, close source file and commit.
  dbms_lob.loadblobfromfile( dest_lob     => des_blob
                           , src_bfile    => src_blob
                           , amount       => dbms_lob.getlength(src_blob)
                           , dest_offset  => des_offset
                           , src_offset   => src_offset );
  -- Close open source file.
  dbms_lob.close(src_blob);
  -- Commit write and conditionally acknowledge it.
  IF src_blob_size = dbms_lob.getlength(des_blob) THEN
    $IF $$DEBUG = 1 $THEN
      dbms_output.put_line('Success!');
    $END
    ROLLBACK;
  ELSE
    $IF $$DEBUG = 1 $THEN
      dbms_output.put_line('Failure.');
    $END
    RAISE dbms_lob.operation_failed;
  END IF;
END load_blob_from_file;
The table structure
CREATE TABLE ITEM
   (     "ID" NUMBER, 
     "TITLE" VARCHAR2(50), 
     "ITEM_BLOB" BLOB
   )
Thanks in advance!
Concerning
34MCA2K2

Published by: BluShadow on June 14, 2012 13:31
addition of {noformat}
{noformat} tags for readability.  Please read {message:id=9360002} and learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

Yes,

Start by creating an object directory point to a physical directory on the server database as the 'oracle '.
user has read/write permissions.

CONN / AS SYSDBA
CREATE or REPLACE DIRECTORY nom_repertoire as 'D:\Applications ';
GRANT READ, WRITE ON DIRECTORY NOM_REPERTOIRE TO USER_NAME;

Here is the diagram user USER_NAME.

Then,.
create and populate a table to contain the images in the database your user to user schema.

and try this procedure...

DECLARE
  l_dir    VARCHAR2(10) := 'DIR_NAME';   ----> Is the Directory Object we created.
  l_file   VARCHAR2(20) := 'site_logo.gif';   ----- > The image to be located in the DB Server in the Directory Path DIR_NAME mentioned.
  l_bfile  BFILE;
  l_blob   BLOB;
BEGIN
  INSERT INTO images (id, name, image)
  VALUES (images_seq.NEXTVAL, l_file, empty_blob())
  RETURN image INTO l_blob;

  l_bfile := BFILENAME(l_dir, l_file);
  DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
  DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
  DBMS_LOB.fileclose(l_bfile);

  COMMIT;
END;

Thank you
Shankar

Tags: Database

Similar Questions

  • How to insert a pdf or jpeg image into a column of type blob of a table

    How to insert a pdf or jpeg image into a column of type blob of a table

    Hello
    Try this

    Loading an image into a BLOB column and showing through OAS
    -------------------------------------------------------------

    The steps are:

    Step 1.
    -------

    Create a table to store BLOBs:

    create BLOB table objects
    (id VARCHAR2 (255),)
    blob_col blob
    );

    Step 2.
    -------

    Create a logical directory in the database to the physical file system:

    create or replace the MY_FILES directory as "c:\images";

    Step 3.
    -------

    Create a procedure to load the BLOB from the file system by using the logic
    Directory. Gif 'aria.gif' must exist in c:\images.

    create or replace procedure insert_img as
    f_lob bfile.
    b_lob blob.
    Start
    insert into BLOB ("MyGif", empty_blob()) values
    return blob_col in b_lob;

    f_lob: = bfilename ("MY_FILES', 'aria.gif');
    DBMS_LOB. FileOpen (f_lob, dbms_lob.file_readonly);
    DBMS_LOB. LoadFromFile (b_lob, f_lob, dbms_lob.getlength (f_lob));
    DBMS_LOB. FileClose (f_lob);
    commit;
    end;
    /

    Step 4.
    -------

    Create a procedure that is called via Oracle Application Server to display the
    image.

    create or replace procedure get_img as
    vblob blob.
    raw buffer (32000);
    buffer_size integer: = 32000;
    offset of an integer: = 1;
    length of number;
    Start
    owa_util.mime_header('image/gif');
    Select blob_col from vblob of blobs where id = 'MyGif. "
    Length: = dbms_lob.getlength (vblob);
    While offset< length="">
    DBMS_LOB. Read (vblob, buffer_size, offset, buffer);
    HTP. PRN (utl_raw.cast_to_varchar2 (buffer));
    offset: = offset + buffer_size;
    end loop;
    exception
    while others then
    HTP.p (SQLERRM);
    end;
    /

    Step 5.
    -------

    Use the PL/SQL cartridge to call the get_img procedure

    OR

    Create this procedure in function and call it your PL/SQL code for
    correctly place the images on your HTML page through the PL/SQL Toolbox.

    from a html form

    1. create an HTML form where the image will be. You too
    need the file MIME type.
    2. create a procedure receives the form parameters. The file field will be a Varchar2
    parameter, because you receive the path of the image is not the image itself.
    3 insert the image file into the table by using 'Create a directory NAME as chemin_image' and
    Then use ' insert into the TABLE (row, BLOB_OBJECT, MIME_OBJECT) values (sequence.nextval, '.
    EMPTY_BLOB() 'GIF' or 'JPEG') BLOB_OBJECT, in the variable_blob, back
    variable_consecutive.
    4 load the file into the table using:
    DBMS_LOB. LoadFromFile (variable_blob, variable_file_name, dbms_lob.getlength (variable_file_name));
    DBMS_LOB. FileClose (variable_file_name);
    engage.

    Kind regards
    Simma...

  • Problem inserting values into a table

    Hi all

    I'm newbe and I'm stack.
    I have a human tasks (model begun), which contains 4 input fields (all channels).
    I have a complex data type called Test, which is defined as 2 channel fileds (Description and result) and a registered number (test).
    I have a Test table, insiemiDiTest.
    What I want to do is to create 2 test object in the input fields and insert in the insiemiDiTest table, to then be able to use the loop to insert into the DB.
    Assume that the user insert the following information in the filed entry:
    INPUT1 descrTest1
    ResultTest1-INPUT2
    INPUT3 descrTest2
    INPUT4 resultTest2
    I want to play in the process of the insiemiDiTest variable of length 2 and the following content:
    insiemiDiTest [1] .testNumber = 1
    insiemiDiTest [1] .description = descrTest1
    insiemiDiTest [1] property = resultTest1
    insiemiDiTest [2] .testNumber = 2
    insiemiDiTest [2] .description = descrTest2
    insiemiDiTest [2] property = resultTest2

    If I use data binding and I have a link
    INPUT1 with .description insiemiDiTest [1]
    INPUT2 with property insiemiDiTest [1]
    Number('1') with .testNumber insiemiDiTest [1]
    I get an error saying that the insiemiDiTest [1] .description is empty and cannot be copied.

    Unfortunaly I can't directly use the table in the task of the user, because later I have to use the conversation when the calling process and we found I have limitation.
    I can get an indication on how to do it.
    I'm approccing in the right way or am I completely wrong?
    Thanks in advance and Merry Christmas.

    Because your input is coming from a few strings and not a table, you can just add a Script activity to your process and to define table of your target XSD using XML.

    To do this, you must add a Script to the activity-> click on "Data Associations"-> drag the icon above your target expression builder object on the right side (not the table but the table parent)-> open the XPath expression box in the Middle-> click 'XPath Exp' in the drop-down list at the top.

    I don't know what your XSD, but in the text below, I tried to show you the XML you need for this XPath expression using the values you provided.

    oraext:parseXML(concat('
    
      
        ','1','
        ',bpmn:getDataObject('descTest1'),'
        ',bpmn:getDataObject('resultTest1'),'
      
    
      
        ','2','
        ',bpmn:getDataObject('descTest2'),'
        ',bpmn:getDataObject('resultTest2'),'
      
    
    '))
    

    When I 'bpmn:getDataObject('...')', you should rather to insert your data object variables four your process chain.

    Hope this helps,
    Dan

  • How to use the slider in the insertion of data in table to another

    Hi all

    I am beginner in oracle and I have a question to deal with my table

    I have 2 table lets say (c1) and (c2).

    C1 contains the following columns (product_number, product_name, description)

    C2 contains the following columns (product_code, product_id, description)

    I need to build anonymous blocks including cursor, this extraction of cursor data c2 to insert in c1 in the following way:

    product_code = product_number,

    product_id = product_name,

    description = description

    a help can you please...?

    Thanks for all,

    Best regards.

    Sorry to say that this is not "talking nonsense." the statement below, you wrote, updated the TABLE whenever a row is inserted:

    Update products

    Set service_code = 'VOIP', Charge_type = 'FIXED', PRODUCT_TYPE = 'SERVICE', super_product = 'n',

    available = 'Y', default_bill_method = 'TIPS', default_prorate = 'Y', gl_code = '00000',.

    service_type = "COMPLEMENTARY", partner_code is "oman", used_service_code = "VOIP."

    I can't believe that's what you intend to update an entire table every time that a row is inserted.

    The second problem I see is that you try to use v_x and you aren't anything to assign to this variable.  Whence 'rownum '?  ROWNUM is generated when choosing and assigned to the rows in a result set.  Looking at a rewrite of your code that actually works now:

    SQL > declare
    2
    3 v_sku TMP_TABLE. Type % SKU;
    v_DESCRIPTION 4 tmp_table. DESCRIPTION of % type;
    5 v_MSRP TMP_TABLE. Type of MSRP %;
    6 v_BILLING_FREQUENCY TMP_TABLE. Type of BILLING_FREQUENCY %;
    7 v_ALLOW_PRICE_CHANGE TMP_TABLE. Type of ALLOW_PRICE_CHANGE %;
    8 v_status TMP_TABLE. % OF STATUS TYPE.
    v_x 9 varchar2 (20);
    10
    11 tmp_product of CURSOR IS
    12. SELECT "p" | status of prod_id, SKU, LTrim (to_char(rowNum,'0999999')), ALLOW_PRICE_CHANGE, BILLING_FREQUENCY, advised, DESCRIPTION retail price
    13 FROM tmp_table
    14 where sku is not null;
    15
    BEGIN 16
    17
    18 open tmp_product;
    19
    loop 20
    21
    22 extract tmp_product in v_x, v_SKU, v_status, v_DESCRIPTION, v_MSRP, v_BILLING_FREQUENCY, v_ALLOW_PRICE_CHANGE;
    23 when the output tmp_product % notfound;
    24
    25 INSERT INTO PRODUCTS (product_code, product_name, description, available, DEFAULT_BILL_FREQ, APPLY_SPECIAL_RATES)
    26 values (v_x, v_SKU, v_DESCRIPTION, v_status, v_BILLING_FREQUENCY, v_ALLOW_PRICE_CHANGE);
    27
    28 END LOOP;
    29 close tmp_product;
    30
    31 products update
    32 set service_code = 'VOIP', Charge_type = 'FIXED', PRODUCT_TYPE = 'SERVICE', super_product = 'n',
    33 available = 'Y', default_bill_method = 'TIPS', default_prorate = 'Y', gl_code = '00000',.
    34 service_type = 'SUPPLEMENTARY', partner_code = 'oman', used_service_code is "VOIP."
    35
    36 commit;
    END 37;
    38.

    PL/SQL procedure successfully completed.

    SQL >
    SQL > select *.
    2 from products
    3 where rownum<>

    PRODUCT_CODE PRODUCT_NAME DESCRIPTION AVAILABLE SERVER PRODUCT_TYPE CHARGE_T DEFAULT_BILL S DEFAULT_BILL D GL_CO PARTNER_ USED_SER APP SERVICE_TYPE
    -------------------- ---------------------------------------- -------------------------------------------------------------------------------- ------------ ------------ -------- -------- ------------ - ------------ - ----- -------------------- -------- -------- ---
    p0000095 Plerkle213 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000096 Plerkle214 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000097 Plerkle215 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000098 Plerkle216 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000099 Plerkle217 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000100 Plerkle218 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000101 Plerkle219 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000102 Plerkle220 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000103 Plerkle221 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000104 Plerkle222 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES

    10 selected lines.

    The update has been moved out of the loop, the useless '<>null' condition has been changed to "is not null" and v_x is generated by the cursor query itself.

    David Fitzjarrell

  • Run error in inserting blob

    Hi good Eve everyone,

    I'm trying to insert a blob in a table. I created a c:\images directory that contains all the images including Afghanistan.gif

    I then created

    my table

    Looks like that

    Name of Type Null

    -------- ---- ------------

    COUNTRY VARCHAR2 (30)

    COUN_IMG BLOB

    then the procedure to insert as below

    create or replace

    PROCEDURE insert_Blob (Country1 IN varchar2, p_filename IN VARCHAR2)

    AS

    l_blob BLOB;

    l_bfile BFILE.

    BEGIN

    INSERT INTO ex_countryflag

    VALUES (COUNTRY1, EMPTY_BLOB ())

    return COUN_IMG IN l_blob;

    l_bfile: = BFILENAME ('images', p_filename);

    DBMS_LOB. FileOpen (l_bfile);

    DBMS_LOB. LoadFromFile (l_blob, l_bfile,

    DBMS_LOB. GetLength (l_bfile));

    DBMS_LOB. FileClose (l_bfile);

    commit;

    END insert_blob;

    When I'm compiling there is no error

    DECLARE

    COUNTRY1 VARCHAR2 (200);

    P_FILENAME VARCHAR2 (200);

    BEGIN

    COUNTRY1: = 'AFGHANISTAN ';

    P_FILENAME: = "Afghanistan.gif";

    () INSERT_BLOB

    Country1 = > countries1.

    P_FILENAME = > P_FILENAME

    );

    END;

    When I run it I get errors of

    ORA-30687: session terminated by the debugger

    ORA-22285: non-existent directory or file for FILEOPEN operation

    Running PL/SQL: CALL the DBMS_DEBUG_JDWP. DISCONNECT()

    No more data to read from socket

    Process is complete.

    Disconnection from the dataaudit database.

    Debugger disconnected from the database.

    but I'm sure that all the images are present in the images directory

    thanking you in advance

    Prakash

    l_bfile: = BFILENAME ('images', p_filename);

    Try 'IMAGES' (uppercase).

  • table name not valid error when inserting values into a table

    I use the following statement to insert values into a table:

    curs. Execute ("INSERT INTO _ * '%s' * _ VALUES ((SELECT MAX (REC_ID) + 1 OF GSAP_MSG_IN), (SELECT MAX (gsap_msg_id) + 1 OF GSAP_MSG_IN), 'SHELLSAP', sysdate, '%s', EMPTY_BLOB(), 1, SYSDATE, EMPTY_BLOB (), SYSDATE)" %(*table_name*,file_extension)) ")

    whence table_name the following statement

    table_name = ' config.staging_db_tablesNames ['in_msgs]

    as I created a configuration file for all parameters that can change. The value of the table in the audit using a print command is correctly, but when put in the query above to run the insert statement gives an error. The following is the summary of comprehensive performance where you can see the table name as

    $ python gsapscnr.py
    Vote for the data files in/home/mh/inbox /...

    GSAP_MSG_IN
    Traceback (most recent call changed):
    File "gsapscnr.py", line 147, in it?
    poll_for_data()
    File "gsapscnr.py", line 86, in poll_for_data
    Sorter = load_details_first)
    File "gsapscnr.py", line 42, survey
    curs. Execute ("INSERT INTO '%s' VALUES ((SELECT MAX (REC_ID) + 1 OF GSAP_MSG_IN), (SELECT MAX (gsap_msg_id) + 1 OF GSAP_MSG_IN), 'SHELLSAP', sysdate, '%s', EMPTY_BLOB(), 1, SYSDATE, EMPTY_BLOB (), SYSDATE)" %(table_name,file_extension)) ")
    cx_Oracle.DatabaseError: ORA-00903: invalid table name

    Can anyone help with this problem please. I'm passing the value of the table in a bad way. Also if anyone can suggest a good tutorial for paythong programming using cx_Oracle.

    Concerning

    Print the SQL string that you establish, cut and paste it this output in SQL * more and see if it runs. This may show you that you should remove the single quotes around the name of the table %s in the Python file.

  • Store an Image in the column of type BLOB of a Table

    It is about saving an Image file, a temp_photo table.

    UNDER LINUX, I created the Directory object.
    Step # 1
    SQL > create directory MSGS3 as ' / home/HD/om4000/I_MESSAGES ";
    Created directory.

    Step 2: set up the temp_photo Table.

    SQL > create table temp_photo
    (
    ID NUMBER (3) NOT NULL,
    PHOTO_NAME VARCHAR2 (50).
    PHOTO BLOB
    );
    Table created.

    Step: 3 this is the procedure that I have created to load the file from the file system of the database.

    create or replace PROCEDURE load_file)
    number of P_ID,
    p_photo_name in varchar2) IS
    src_file BFILE.
    dst_file BLOB;
    lgh_file directory.
    BEGIN
    src_file: = bfilename ('MSGS3', p_photo_name);
    -Insert a NULL record to lock
    INSERT INTO temp_photo
    (id, photo_name, photo)
    VALUES
    (p_id, p_photo_name, EMPTY_BLOB())
    RETURN photo INTO dst_file;
    -lock the folder
    SELECT photo
    IN dst_file
    OF temp_photo
    ID WHERE p_id =
    AND photo_name = p_photo_name
    UPDATE;
    -Open the file
    DBMS_LOB. FileOpen (src_file, dbms_lob.file_readonly);
    -determine the length
    lgh_file: = dbms_lob.getlength (src_file);
    -Read the file
    DBMS_LOB. LoadFromFile (dst_file, src_file, lgh_file);
    -update the blob field
    UPDATE temp_photo
    Photo SET dst_file =
    ID WHERE p_id =
    AND photo_name = p_photo_name;
    -close file
    DBMS_LOB. FileClose (src_file);
    END load_file;
    /


    Step 4: when I test it by running the procedure in the following assistance:
    SQL > execute load_file (1, 'Omega5000.jpg');

    I get the following error:

    Error from line 5 in order:
    run load_file(1,'Omega5000.gif')
    Error report:
    ORA-22288: file or LOB FILEOPEN operation failed
    No such file or directory
    ORA-06512: at "SYS." DBMS_LOB", line 805
    ORA-06512: at "HD. Load_file", line 23
    ORA-06512: at line 1
    22288 00000 - "file or LOB operation %s failed\n%s".
    * Cause: Failure of the attempted operation on the file or the LOB.
    * Action: See the following error message in the more detailed error stack
    information. In addition, make sure that the file or LOB exists and that
    privileges are set for the specified operation. If
    the error continues, report the error to the user DBA.

    He said: no such file or directory, but I double checked that the file is located in the same directory and directory is it physically (for which I created the above directory object.)
    Can someone help me where I'm doing something wrong. This is the first time I use the BLOB in my table. Can anyone suggest what's not here.

    >
    He said: no such file or directory, but I double checked that the file is located in the same directory and directory is it physically (for which I created the above directory object.)
    >
    Oracle is disagreeing with you.

    Post your proof that the file exists in the path you provided.

    See this example Oracle-base
    http://www.Oracle-base.com/articles/Misc/HTML-with-embedded-images-from-plsql.php
    >
    CONN / AS SYSDBA
    CREATE or REPLACE DIRECTORY of images AS "/ host /";
    GRANT READ, WRITE on DIRECTORY images TO test;
    >
    Write down everything you missed? Tip: Look at the last character of the DIRECTORY string. Second Tip: See the grant?

    SQL>create directory MSGS3 as '/home/mh/om4000/I_MESSAGES' ;
    
  • Read data from table of $ E and insert in the staging table

    Hi all

    I'm new on ODI. I need your help to understand how to read data from a table ' E$ "and insert in an intermediate table.

    Scenario:

    The name of two columns, in a flat file, the employee and the employee id must be loaded into a data EMPstore +. A check constraint is added so that the data with the employee names in capital letters only to load in the data store. Check the command is set to the static movement . Right-click on the data store, select control , then check. The lines that have violated the check constraint are kept in E$ _EMP+ table.

    Problem:

    Problem is I want to read the data in the table E$ _EMP+ and transform in capital letters in the name of the employee and move the corrected data of E$ _EMP+ EMP+. Please advise me on how to automatically manage the 'soft' exceptions in ODI.

    Thank you

    If I understand, you want to change the columns in the tables of $ E and then load into the target.

    Now, if you notice how ODI recycles the error, there is an incremental update to the target using the E table $ after he filled the I$ table.

    I think you can do the same thing by creating an interface using the table of $ E as source and implement the business logic in this interface to fill the target.

  • Doubt about inserting data into a table

    Hi all, when I try to insert data into a table through an anonymous block, the pl/sql block runs successfully, but the data are not get inserted. Can someone please tell me where I am doing wrong?
    SQL> DECLARE
      2
      3  V_A NUMBER;
      4
      5  V_B NUMBER;
      6
      7  v_message varchar2(25);
      8
      9
     10  BEGIN
     11
     12
     13  select regal.regal_inv_landed_cost_seq.NEXTVAL into V_A from dual ;
     14
     15  select regal.regal_inv_landed_cost_seq.currval into V_B from dual ;
     16
     17  INSERT INTO rcv_transactions_interface
     18  (
     19               INTERFACE_TRANSACTION_ID,
     20               HEADER_INTERFACE_ID,
     21               GROUP_ID,
     22               TRANSACTION_TYPE,
     23               TRANSACTION_DATE,
     24               PROCESSING_STATUS_CODE,
     25               PROCESSING_MODE_CODE,
     26               TRANSACTION_STATUS_CODE,
     27               QUANTITY,
     28               LAST_UPDATE_DATE,
     29               LAST_UPDATED_BY,
     30               CREATION_DATE,
     31               CREATED_BY,
     32               RECEIPT_SOURCE_CODE,
     33               DESTINATION_TYPE_CODE,
     34               AUTO_TRANSACT_CODE,
     35               SOURCE_DOCUMENT_CODE,
     36               UNIT_OF_MEASURE,
     37               ITEM_ID,
     38               UOM_CODE,
     39               EMPLOYEE_ID,
     40               SHIPMENT_HEADER_ID,
     41               SHIPMENT_LINE_ID,
     42               TO_ORGANIZATION_ID,
     43               SUBINVENTORY,
     44               FROM_ORGANIZATION_ID,
     45               FROM_SUBINVENTORY
     46  )
     47
     48  SELECT
     49       regal.regal_inv_landed_cost_seq.nextval,      --Interface_transaction_
    id
     50       V_A,                                          --Header Interface ID
     51       V_B,                                          --Group ID
     52       'Ship',                                       --Transaction Type
     53       sysdate,                                      --Transaction Date
     54       'PENDING',                                    --Processing Status Code
    
     55       'BATCH',                                      --Processing Mode Code
     56       'PENDING',                                    --Transaction Status Cod
    e
     57       lc.quantity_received,                          --Quantity
     58       lc.last_update_date,                          --last update date
     59       lc.last_updated_by,                           --last updated by
     60       sysdate,                                      --creation date
     61       lc.created_by,                                --created by
     62       'INVENTORY',                                  --Receipt source Code
     63       'INVENTORY',                                  --Destination Type Code
     64       'DELIVER' ,                                    --AUT Transact Code
     65       'INVENTORY',                                  --Source Document Code
     66        msi.primary_uom_code ,                       --Unit Of Measure
     67        msi.inventory_item_id,                        --Item ID
     68        msi.primary_unit_of_measure,                  --UOM COde
     69        fnd.user_id,
     70        V_A,                                         --Shipment Header ID
     71        V_B,                                         --SHipment Line ID
     72        82,                                           --To Organization ID
     73        'Brooklyn',                                     --Sub Inventory ID
     74        81,                                            --From Organization
     75        'Vessel'                                       --From Subinventory
     76
     77    FROM
     78       regal.regal_inv_landed_cost_tab lc,
     79       fnd_user fnd,
     80       mtl_system_items msi
     81
     82    WHERE
     83       lc.organization_id = msi.organization_id
     84       AND  lc.inventory_item_id = msi.inventory_item_id
     85       AND  lc.created_by = fnd.created_by;
     86
     87  commit;
     88  v_message := SQL%ROWCOUNT;
     89  dbms_output.put_line('v_message');
     90  END;
     91  /
    v_message
    
    PL/SQL procedure successfully completed.
    SQL> select * from rcv_transactions_interface;
    
    no rows selected
    Thanks in advance!

    There is no problem with inserting data!
    Only there is no data! This means that your select statement retrieves no rows.
    You can see the output of your program (0). This means that there where no line in the result set.

    Please check the output of your tax return independently:

    SELECT
    --        regal.regal_inv_landed_cost_seq.nextval,      --Interface_transaction_id
     --       V_A,                                          --Header Interface ID
    --        V_B,                                          --Group ID
            'Ship',                                       --Transaction Type
            sysdate,                                      --Transaction Date
            'PENDING',                                    --Processing Status Code
            'BATCH',                                      --Processing Mode Code
            'PENDING',                                    --Transaction Status Code
            lc.quantity_received,                          --Quantity
            lc.last_update_date,                          --last update date
            lc.last_updated_by,                           --last updated by
            sysdate,                                      --creation date
            lc.created_by,                                --created by
            'INVENTORY',                                  --Receipt source Code
            'INVENTORY',                                  --Destination Type Code
            'DELIVER' ,                                    --AUT Transact Code
            'INVENTORY',                                  --Source Document Code
             msi.primary_uom_code ,                       --Unit Of Measure
             msi.inventory_item_id,                        --Item ID
             msi.primary_unit_of_measure,                  --UOM COde
             fnd.user_id,
      --       V_A,                                         --Shipment Header ID
    --         V_B,                                         --SHipment Line ID
             82,                                           --To Organization ID
             'Brooklyn',                                     --Sub Inventory ID
             81,                                            --From Organization
             'Vessel'                                       --From Subinventory
         FROM
            regal.regal_inv_landed_cost_tab lc,
            fnd_user fnd,
            mtl_system_items msi
         WHERE
            lc.organization_id = msi.organization_id
            AND  lc.inventory_item_id = msi.inventory_item_id
            AND  lc.created_by = fnd.created_by;
    

    Published by: hm on 13.10.2011 23:19

    I removed the references of the sequence and the variables V_A and YaeUb.
    BTW: Why do you want to include V_A and YaeUb in two different columns?

    The use of sequences in your code seems a bit strange to me. But this has nothing to do with your question.

  • Why multi-threaded INSERT on the same table cannot work in a single connection

    Environment: Win2k3, oracle10g, .net 2.

    I tried the two roads, insert into a table with 20 columns. The code cannot be run directly, it describes just my thought. Note * [Q n] * and answer me please.

    1. all OracleCommands share a single connection
    main()
    {
    CNN OracleConnection = new OracleConnection;
    [] Ths thread = new Thread [32]; 4 thread per CPU
    for (int j = 0; j < ths.) Length; j ++)
    {
    Thread th = ths [j] = new Thread (proc);
    FPE Start (CNN).
    }
    }
    the static object sync_obj = new object();
    Sub proc (object param)
    {
    OracleConnection cnn = param as OracleConnection;
    OracleCommand cmd is cnn. CreateCommand();
    cmd.CommandText =...; Insert statement on a specific table, using parameters
    Lock (sync_obj) / / * [Q1] *: why lock is necessary? Deleting the line will result in ORA-01036 occasionally, details at the end
    {
    cmd ExecuteNonQuery());
    }
    }


    2. a connection by OracleCommand
    main()
    {
    [] Ths thread = new Thread [32]; 4 threads per processor
    for (int j = 0; j < ths.) Length; j ++)
    {
    Thread th = ths [j] = new Thread (proc);
    Th. Start();
    }
    }
    Sub proc (object param)
    {
    CNN OracleConnection = new OracleConnection;
    OracleCommand cmd is cnn. CreateCommand();
    cmd.CommandText =...; Insert statement on a specific table, using parameters

    * [Q2] *: why the lock is useless for a successful run?
    cmd ExecuteNonQuery());
    }

    * [T3] * is it true that INSERT statement does not engage the table of data at all?
    * [T4] * as shown in the code, it is the rule that a single INSERTION in a same table capable of running at the same time in a single connection?

    In fact, I want to insert thousands of records to a table, each thread can insert several hundred.

    I appreciate if you can provide a detailed answer and I am very happy that you can send the answer to [email protected] , because I check the email more frequently than the OTN forum.

    * EXCEPTIONAL DETAIL WHEN LINE [Q1] IS DELETED *.
    Message = "" ORA-01036: invalid variable/index ""
    Source = "System.Data.OracleClient"
    ErrorCode =-2146232008
    Code = 1036
    StackTrace:
    At System.Data.OracleClient.OracleConnection.CheckError (OciErrorHandle errorHandle, Int32 rc)
    At System.Data.OracleClient.OracleParameterBinding.Bind (mustRelease, SafeHandle, OciStatementHandle statementHandle, NativeBuffer parameterBuffer, OracleConnection connection, Boolean & handleToBind)
    At System.Data.OracleClient.OracleCommand.Execute (rowidDescriptor, ArrayList, OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor & resultParameterOrdinals)
    At System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal (Boolean needRowid, OciRowidDescriptor & rowidDescriptor)
    At System.Data.OracleClient.OracleCommand.ExecuteNonQuery)
    At ConsoleApplication1.Program.proc (Object param) POS D:\testing\ConsoleApplication1\ConsoleApplication1\Program.cs:Line 92
    At System.Threading.ThreadHelper.ThreadStart_Context (Object state)
    At System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state)
    At System.Threading.ThreadHelper.ThreadStart (Object obj)

    Yes, you do want to use Array Binding with CLOB or BLOB because of how OIC works. A round trip must occur to the database to get a lob index and a temporary lob must be built for each of them. If your type LOB data<32k you="" can="" bind="" them="" as="" varchar2/raw="" and="" you="" should="" see="" a="" performance="" increase,="" but="" if="" you="" do="" indeed="" need="" to="" bind="" as="" lob="" you'll="" want="" to="" do="" it="" via="" single="">

    Greg

  • Changing aid necessary table problem

    Hello. I hope someone can help me with this problem.

    I have two tables, an and mv. Create the following script:

    create table (mv)
    the moduleId Char (2) CONSTRAINT ck_moduleId CHECK (moduleId in ("M1", "M2", "M3", "M4', 'M5', 'M6', 'M7', 'M8'")).
    credit ck_credits Number (2) CONSTRAINT CHECK (credits (10, 20, 40));
    constraint pk_mv primary key (moduleId)
    );

    create table (its)
    stuId Char (2) CONSTRAINT ck_stuId CHECK (stuId ('S1', 'S2', 'S3', 'S4', 'S5')),
    moduleId tank (2),
    primary key constraint (stuId, moduleId) pk_sa,
    constraint fk_moduleid foreign key (moduleId) references (moduleId) mv
    );

    And the scripts below is to insert data into the two:

    insert into VALUES mv ("M1", 20)
    /
    insert into VALUES mv ("M2", 20)
    /
    insert into VALUES mv ("M3", 20)
    /
    insert into VALUES mv ("M4", 20)
    /
    Insert in mv VALUES ('M5', 40)
    /
    insert into VALUES mv ("M6", 10)
    /
    insert into VALUES mv ("M7", 10)
    /
    Insert in mv VALUES ('M8', 20)
    /


    insert into a VALUES ('S1', 'M1')
    /
    insert into a VALUES ('S1', 'M2')
    /
    insert into a VALUES ('S1', 'M3')
    /
    insert into a VALUES ('S2', 'M2')
    /
    insert into a VALUES ('S2', 'M4')
    /
    insert into a VALUES ('S2', 'M5')
    /
    insert into a VALUES ('S3', 'M1')
    /
    insert into a VALUES ('S3', 'M6')
    /

    Now for the real problems.

    First of all, I need to try to overcome the problem of table mutation ensure that stuid = S1 in table its can not take the two moduleId M5 and M6.

    Just one or the other. I created a single trigger, but runs aground because of the changing table problem.

    The second problem that I need to overcome is that none of the stuids can have the ModuleID where total value of more than 120 credit credits. Credit value is stored in the table of mv.

    Thank you very much in advance for any help.

    Use a statement-level trigger:

    First of all, I need to try to overcome the problem of table mutation ensure that stuid = S1 in table its can not take the two moduleId M5 and M6.

    SQL> create or replace trigger sa_trg
      2  after insert or update on sa
      3  declare
      4  c number;
      5  begin
      6    select count(distinct moduleId) into c
      7    from sa
      8    where stuid = 'S1'
      9    and moduleId in ('M5','M6');
     10    if c > 1 then
     11       raise_application_error(-20001,'S1 on both M5 and M6!!');
     12    end if;
     13  end;
     14  /
    
    Trigger created.
    
    SQL> select * from sa;
    
    ST MO
    -- --
    S1 M1
    S1 M2
    S1 M3
    S2 M2
    S2 M4
    S2 M5
    S3 M1
    S3 M6
    
    8 rows selected.
    
    SQL> insert into sa values ('S1','M5');
    
    1 row created.
    
    SQL> insert into sa values ('S1','M6');
    insert into sa values ('S1','M6')
    *
    ERROR at line 1:
    ORA-20001: S1 on both M5 and M6!!
    ORA-06512: at "SCOTT.SA_TRG", line 9
    ORA-04088: error during execution of trigger 'SCOTT.SA_TRG'
    

    The second problem that I need to overcome is that none of the stuids can have the ModuleID where total value of more than 120 credit credits. Credit value is stored in the table of mv

    SQL> create or replace trigger sa_trg
      2  after insert or update on sa
      3  declare
      4  c number;
      5  begin
      6    select count(distinct moduleId) into c
      7    from sa
      8    where stuid = 'S1'
      9    and moduleId in ('M5','M6');
     10    if c > 1 then
     11       raise_application_error(-20001,'S1 on both M5 and M6!!');
     12    end if;
     13
     14    select count(*) into c from (
     15    select stuid
     16    from mv, sa
     17    where sa.moduleid=mv.moduleid
     18    group by stuid
     19    having sum(credits)>120);
     20
     21    if c > 0 then
     22       raise_application_error(-20002,'A student cannot have more than 120 credits!!');
     23    end if;
     24
     25  end;
     26  /
    
    Trigger created.
    
    SQL>   select stuid, sum(credits)
      2  from mv, sa
      3  where sa.moduleid=mv.moduleid
      4  group by stuid;
    
    ST SUM(CREDITS)
    -- ------------
    S3           30
    S2           80
    S1          100
    
    SQL> insert into sa
      2  values ('S1','M4');
    
    1 row created.
    
    SQL>   select stuid, sum(credits)
      2  from mv, sa
      3  where sa.moduleid=mv.moduleid
      4  group by stuid;
    
    ST SUM(CREDITS)
    -- ------------
    S3           30
    S2           80
    S1          120
    
    SQL> insert into sa
      2  values ('S1','M7');
    insert into sa
    *
    ERROR at line 1:
    ORA-20002: A student cannot have more than 120 credits!!
    ORA-06512: at "SCOTT.SA_TRG", line 20
    ORA-04088: error during execution of trigger 'SCOTT.SA_TRG'
    

    Max
    http://oracleitalia.WordPress.com

  • Write the BLOB in a table

    I have a page where users download files in a custom table (contents of the file as BLOB store). I use wwv_flow_files to select from a page process to insert in my custom table. For some reason, the insert does not create a file. If I try to select in wwv_flow_files, I don't see anything.


    Am I missing something?

    Here is my table:

    report_layout
    PK_ID NOT NULL VARCHAR2 (32)
    FK_FORM VARCHAR2 (32)
    REPORT_LAYOUT VARCHAR2 (30)
    REPORT_LAYOUT_DESC VARCHAR2 (50)
    REPORT_QUERY VARCHAR2 (30)
    NAME VARCHAR2 (255)
    MIMETYPE VARCHAR2 (255)
    BLOB OBJECT MODEL

    On my page, I have 'FILENAME' and 'MIME Type' set to hidden and 'MODEL' the value leader go. I have created a process that only inserts the record:

    Start
    get_pk: = sis_express.get_sys_guid ();
    BEGIN
    Insert in "#OWNER #".report_layout ".
    (pk_id, fk_form, report_layout, report_layout_desc, report_query, file name, MIME type, model)
    Select get_pk,
    : P539_FK_FORM,.
    : P539_REPORT_LAYOUT,.
    : P539_REPORT_LAYOUT_DESC,.
    : P539_REPORT_QUERY,.
    file name,
    mime_type,
    blob_content
    of wwv_flow_files
    where filename =: P539_FILENAME;
    -EXCEPTION when dup_val_on_index then null;
    END;
    END;

    «In my page, I have 'FILENAME' and 'MIME Type' set to hidden and 'MODEL' the value leader go.» "I have created a process that only inserts the record:

    «.. . from wwv_flow_files
    where filename =: P539_FILENAME; »

    What should we not

    of wwv_flow_files
    where filename =: P539_TEMPLATE

    ?

    See this example on how to manage download / download:

    http://Apex.Oracle.com/pls/OTN/f?p=31517:15

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Error when inserting rows into a table

    Hello

    We have recently migrated to 9i and 10g. We have a scheduled task on our database who first removes all rows from a table and then inserts them back by selecting the lines of 5 tables. This table has a composite primary key based on 6 columns in it. In 9i, when I try to insert rows in the table after you remove all of the lines, I am able to insert the data successfully. However, in 10g, when I try to do the same operation, it fails with error ORA:

    ORA-00001: unique constraint violated

    The same query that works perfectly in 9i fails in 10g

    If anyone has some ideas on how to solve the same, kindly let me know.

    Thanks in advance.

    CrazyAnie wrote:
    Okay, so now the only option that remains is that I have load the data into a local table and then perform the loading.

    May not be the only option, but the safest and cleanest I would say.

    CrazyAnie wrote:
    Also, it would be very kind of you that you might suggest all other possible risk areas where this CHARSET conversion could be a concern.

    I imagine that the main areas of concern will be you are interfacing directly with other databases through database links and using string functions. Otherwise, as long as the manipulation of data is in the same database 10g should not be a problem.

    CrazyAnie wrote:
    I made the migration of my source 9i DB, which is on Solaris to my 10g database which is on Linux and a separate server (which resides in a completely different location) uses exp and IMP. So if I try to export my schema after you change the CHARACTER set and then import it into the target DB, should that help me to get rid of this error? What is an option that can be done?

    I don't think it would be that simple change your database character set, check out this link for discussions about the same:

    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:5783936214008]

  • How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    What is the formula?

    You can do this with a column of "index" in table 1, as this assistance:

    The formula in C2, filled to the bottom:

    IF (B =<>

    That increments a counter each time that it finds a negative number in column B.

    In the second table, you can retrieve a list of negative values in this way:

    The formula in A2, filled to the bottom:

    = INDEX (array 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0))

    It takes the line number, the formula is activated, subtracts 1 to the header line and look up the result in the column of table 1 C.  If it finds a match, it feeds the line number to the INDEX page with retrieves the value of the column of table 1A.

    To hide the red triangles of signage wrap the IFERROR formula, like this:

    = SIERREUR (INDEX (table 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0)),"")

    Of course, you can also simply filter on column B without the need to set up a column from another table or index.

    SG

  • Insert the ring into table

    Dear all,

    Is it possible to insert the ring into Table?

    I have a Table whose values are constant, but not fixed, for example, Col 1 can be set to 1 or 2.

    I am attaching the picture of the table to show clearly what I want.

    Collar "Site" can have values On or OFF.

    Nervous collar can have the values 1, 2 or 3.

    Col. Ampl can have values from Ridge to Ridge or Bs - PK.

    Is it possible to make a table to store multiple values for a cell?

    Thank you

    Ritesh

    Hi Mickaël

    This link will give you full details about your query. If it works let me know.

    http://forums.lavag.org/table-with-drop-down-items-t11249.html

Maybe you are looking for

  • Not sleep anymore after update 10.11.6

    Immediately after the 10.11.6 MacPro 2013, not going into sleep. I tried everything: restart with the 'Safe mode' user, Zap PRAM, switching, cancellation of the preference of the energy saver and Finder, detachment of two HD USB3, detachment of the c

  • Need info on hard drive

    Hello! What kind of drive hard toshiba laptop mod adapts. PAS407E-BI have no more information, its my phone friends, he bought it without player!

  • x4000b

    Hello I have a lenovo ultrabook 8 pro 64-bit windows-based Helix.  The lack of USB ports (I know I could buy a hub), I decided to buy a Bluetooth mouse.  I was in a hurry so bought the HP x4000b mouse.  I have successfully connected to the Tablet, bu

  • How can I make the computer asks for a password before downloading a program?

    How can I make the computer asks for a password before downloading a program?

  • HP Photosmart 5510 smdge card or envelope printing

    I use a HP Photosmart 5510 When I print a map or an envelope there is always a task on the right side. I think that perhaps it's the feed - paper roll or something else I don't have this problem when using plain paper if there is stock to leave I wou