Problem inserting a gif into a blob field in a table with sqldev / forms6i

Problem solved - For those that might be interested, the errors don't make much sense - the problem was with the gif. Seems that these 28 gifs plus the new scans were saved from the scanner with
GIF - LZW, Transparent color: 255
Converting them to Black and white allowed them to be loaded.
If anyone understands why, I'd like to know
glenn
I was previously having a problem deleting a row with a blob and it was suggested that I create the table using rowdependencies - which I did as follows.
CREATE TABLE "MDD"."MDD_FIGURE2"
(     "FG_FIGURENAME" VARCHAR2(18 BYTE),
     "FG_FIGURE" BLOB,
     CONSTRAINT "FG_FIGURENAME_NN" CHECK ("FG_FIGURENAME" IS NOT NULL) ENABLE
) ROWDEPENDENCIES;
Then I copied my data from my previous table with the following - and everything came across
INSERT INTO MDD_FIGURE2 (fg_figurename, fg_figure)
SELECT FIG_FIGNAME, FIG_FIGURE FROM MDD_FIGURE;
mdd_figure2 was then renamed to mdd_figure
The table, Mdd_Figure, already contains some 2000+ .gifs that were successfully loaded with Forms 6i (yes, I know it is old, but I am stuck with having to use it). All the .gifs I am loading are from scans and all are less than 64k. However, 28 .gifs would not load. When I insert the .gif into the field and committed the form, the status message tells me a record was written but when I check it, the blob is empty.
So, when I try to insert one of these problem .gifs in SqlDeveloper, I open the new mdd_figure table, select the blob field, open the edit dialog, set it to figure, select the .gif that I want to load and then save it. The blob field changes from NULL to BLOB, but it is empty. When I try to commit, I get the following error from SqlDev.
UPDATE "MDD"."MDD_FIGURE" SET WHERE ROWID = 'AAAOeWAAEAAABAlAAz' AND ORA_ROWSCN = '358136842'
One error saving changes to table "MDD"."MDD_FIGURE":
Row 14: ORA-01410: invalid ROWID
I use rollback to restore the record to it's previous state.
If I load one of the successfully loaded .gifs into the same field, it loads perfectly as follows.
UPDATE "MDD"."MDD_FIGURE" SET WHERE ROWID = 'AAAOeWAAEAAABAoAAp' AND ORA_ROWSCN = '358136522'
Commit Successful
It appears the 28 gifs have a problem. I've re-scanned them, with the same results. They are just small scanned line map images from our earlier publications. They view properly in several different graphics programs and I can't find anything wrong with them.
I notice that the ROWID's are different while the ORA_ROWSCN's are the same - but what is the significance of that?
Any suggestions as to what is happening and what I can do about it?
Thanks for any help you can give me.
glenn
(Database is 10R2 and sqldev is the most recent one)
Edited by: gconley on Sep 25, 2008 9:51 PM

solved it myself - problem was with the gif

Similar Messages

  • Problem with update of BLOB field in a table with compound primary key

    Hi,
    I've been developing an application in Application Express 3.1.2.00.02 that includes processing of BLOB data in one of the tables (ZPRAVA). Unfortunately, I've come across a strange behaviour when I tried to update value in a BLOB field for an existing record via a DML form process. Insert of a new record including the BLOB value is OK (the binary file uploads upon submiting the form without any problems). I haven't changed the DML process in any way. The form update process used to work perfectly before I'd included the BLOB field. Since than, I keep on getting this error when trying to update the BLOB field:
    ORA-20505: Error in DML: p_rowid=3, p_alt_rowid=ID, p_rowid2=CZ000001, p_alt_rowid2=PR_ID. ORA-01008: not all variables bound
    Unable to process row of table ZPRAVA.
    OK
    Some time ago, I've already created another application where I used similar form that operated on a BLOB field without problems. The only, but maybe very important, difference between both the cases is that the first sucessfull one is based on a table with a standard one-column primary key whereas the second (problematic one) uses a table with compound (composite) two-column PK (two varchar2 fields: ID, PR_ID).
    In both cases, I've followed this tutorial: [http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm]).
    Can anybody confirm my suspicion that Automatic Row Processing (DML) can be used for updating BLOB fields within tables with only single-column primary keys?
    Thanks in advance.
    Zdenek

    Is there a chance that the bug will be included in the next patch?No, this fix will be in the next full version, 3.2.
    Scott

  • How can I insert a image into a BLOB column in a table?

    I am using forms6i against a 10gR2 database and I have one table with a BLOB column and I try to insert a image into this column. I get ORA-01461 error.
    The curious case is that in another table with a BLOB column it works very fine.
    What happens with the first table? How can I avoid the error?
    Thanks in advance.

    Hi hyue,
    Thanks for visiting Apple Support Communities.
    If you would like to add an image to a project in iMovie for iOS, see this article for helpful steps:
    iMovie for iOS (iPad): Add photos to a project
    http://support.apple.com/kb/PH3171
    All the best,
    Jeremy

  • Problem inserting large files into a Blob-Column

    hi all,
    i am using a oracle 10g database.
    i defined a table including one blob column as follows:
    create table contact(
    id     number(22) primary key not null,
    lastupdated date not null,
    lastwriter_id number(22) not null,
    contacttype_id number(22) not null,
    notice varchar2(2000),
    attachment blob,
    attachmentname varchar2(255))
    tablespace users
    storage (initial 2M pctincrease 0)
    lob (attachment) store AS (
    tablespace users
    storage (initial 10M)
    enable storage in row
              pctversion 5
              chunk 1
    index lob_attachment_idx (tablespace users storage (initial 1M)));
    now i fill this table from a java application using hibernate.
    small files (for example 2700 chars) are ok, the pass into the attachment column.
    larger files dont go there. i receive no errormessage.
    whats going wronr?
    ist my create table statement wrong?
    thnax for help dieter

    Quick and dirty testcase:
    test@ORA10G>
    test@ORA10G> --
    test@ORA10G> drop table t;
    Table dropped.
    test@ORA10G> create table t (x blob);
    Table created.
    test@ORA10G>
    test@ORA10G> insert into t (x)
      2  select utl_raw.cast_to_raw(rpad('a',1000,'x')) from dual;
    1 row created.
    test@ORA10G>
    test@ORA10G> commit;
    Commit complete.
    test@ORA10G>
    test@ORA10G> --
    test@ORA10G> select dbms_lob.getlength(x) as len, dbms_lob.substr(x,10,1) as chunk from t;
           LEN CHUNK
          1000 61787878787878787878
    test@ORA10G>
    test@ORA10G>pratz

  • Upload an .doc attachment into a blob field in Oracle

    sir i have to upload a .doc file into a blob field in the oracle database.
    help with any code, or code links
    The code i am having,pls suggest if any changes...
    String QUERY_ENHANCEMENT = "INSERT INTO EKMIS_ENHANCEMENT(USER_ID,ENH_TYPE,MODULE,DESCRIPTION,ATTACHMENT)";
         QUERY_ENHANCEMENT = QUERY_ENHANCEMENT+"VALUES(?,?,?,?,?)";
              PreparedStatement preparedStatement = connection.prepareStatement(QUERY_ENHANCEMENT);
         preparedStatement.setString(1, enhancementTO.getUserid());
         preparedStatement.setString(2, enhancementTO.getType());
         preparedStatement.setString(3, enhancementTO.getModule());
         preparedStatement.setString(4, enhancementTO.getDescription());
         try
              File anyFile = new File(enhancementTO.getPath());
              InputStream is = new FileInputStream(anyFile);
              preparedStatement.setBinaryStream( 5, is, (int)(anyFile.length()));
         catch(FileNotFoundException fnfe)
              System.out.println("Exception while archiving to BLOB/CLOB");
              fnfe.printStackTrace();
         return preparedStatement;

    the html form is like this..
    <table width="780" cellpadding="2" cellspacing="0" border="0">
                   <tr>
                        <td colspan="6" class="SectionHeader">USER COMMENTS/SUGGESTIONS/COMPLAINTS</td>
                   </tr>
                   <tr>
                                       <td height="18" class="boldLabel_RA">
                                            User Id
                                       </td>
                                       <td height="18" class="value_LA">
                                            <input name="userId" type="text" class="big" readonly="true" value="{sessionAttributes/ekmis.UserID}"/>
                                       </td>
                                       <td height="18" class="boldLabel_RA">
                                            User Name
                                       </td>
                                       <td height="18" class="value_LA">
                                            <input name="userName" type="text" class="big" readonly="true" value="{sessionAttributes/ekmis.UserName}"/>
                                       </td>
                                       <td height="18" class="boldLabel_RA">
                                            Select Type
                                       </td>
                                       <td height="18" class="value_LA">
                                            <select class="big" name="type">
                                                 <option value="0"/>
                                                 <option value="E">Enhancement</option>
                                                 <option value="S">Suggestion</option>
                                                 <option value="B">Bug</option>
                                            </select>
                                       </td>
                                  </tr>
                   <tr>
                        <td height="18" class="boldLabel_RA">Select Module</td>
                        <td colspan="5" height="18" class="value_LA">
                             <select name="mod" class="extralong">
                             <option value="0"/>
                                  <xsl:call-template name="getModules" >
                                       <xsl:with-param name="modules" select="requestParameters/param[@name='sat']" />
                                  </xsl:call-template>
                             </select>
                        </td>
                   </tr>
                   <tr>
                        <td colspan="6" class="SectionHeader"/>
                   </tr>
                   <tr>
                        <td height="18" class="boldLabel_RA">Description</td>
                        <td colspan="5" height="18" class="value_LA">
                             <textarea name="description" class="big"/>
                        </td>
                   </tr>
                   <tr>
                        <td height="18" class="boldLabel_RA">Add Attachment</td>
                        <td colspan="5" height="18" class="value_LA">
                             <input name="path" type="file" class="big"/>
                        </td>
                   </tr>
              </table>

  • PHP - Load Gif image into Oracle Blob field - ORA-00972 error

    I am receiving an " ORA-00972 - Identifier Is too Long" error message when I try to update a BLOB field with file contents from a gif file.
    __GIF FILES_:_
    c:\bl\x_PageLayout-4_LA.gif (15K)
    c:\bl\x_PageLayout-4_Spec.gif (21k)
    ===================================================================================================================================
    ORACLE DATABASE (STYLEELEMENTPIX TABLE):*
    STYLE_ID NUMBER
    SEQ_KEY NUMBER
    PIX_NAME VARCHAR2(30 BYTE)
    PIX BLOB
    PIX_LABEL VARCHAR2(30 BYTE)
    MODIFY_DATE DATE
    PIX_TYPE CHAR(1 BYTE)
    DEFAULTDISPLAY CHAR(1 BYTE)
    PIX field currently is null
    ===================================================================================================================================
    PHP CODE:*
    $filename = 'C:\BL\\';
    $filename .= $row->PIX_NAME; //filename of gif ex: c:\bl\x_PageLayout-4_LA.gif
    $fp = fopen($filename, "rb"); //open gif file
    $file_content = fread($fp, filesize($filename)); //read gif file
    //set gif file in PIX field (PIX datatyle BLOB)
    $cursor1 = oci_parse($conn, "UPDATE STYLEELEMENTPIX SET PIX = '$file_content' WHERE STYLE_ID = $row->STYLE_ID AND SEQ_KEY = $row->SEQ_KEY");
    oci_execute ($cursor1);
    For both records, style id will be 100 ($row->STYLE_ID), and seq_key will be 1 for the first record and 2 for the second ($row->SEQ_KEY)
    ===================================================================================================================================
    ERROR MESSAGE:
    Warning: oci_parse() [function.oci-parse]: ORA-00972: identifier is too long in C:\wamp\www\eStyleGuide\Admin\BLOB.php on line 44 ($cursor1 = ....)

    Use a LOB locator. See "Inserting and Updating LOBs" on p 193 of the free book http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html
    A more concerning issue is the security implications of using string concatenation to construct the SQL statement. It is recommended to use bind variables.

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

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

    Hi,
    Try This
    Loading an image into a BLOB column and displaying it via OAS
    The steps are as follows:
    Step 1.
    Create a table to store the blobs:
    create table blobs
    ( id varchar2(255),
    blob_col blob
    Step 2.
    Create a logical directory in the database to the physical file system:
    create or replace directory MY_FILES as 'c:\images';
    Step 3.
    Create a procedure to load the blobs from the file system using the logical
    directory. The gif "aria.gif" must exist in c:\images.
    create or replace procedure insert_img as
    f_lob bfile;
    b_lob blob;
    begin
    insert into blobs values ( 'MyGif', empty_blob() )
    return blob_col into 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;
    buffer raw(32000);
    buffer_size integer := 32000;
    offset integer := 1;
    length number;
    begin
    owa_util.mime_header('image/gif');
    select blob_col into vblob from blobs where id = 'MyGif';
    length := dbms_lob.getlength(vblob);
    while offset < length loop
    dbms_lob.read(vblob, buffer_size, offset, buffer);
    htp.prn(utl_raw.cast_to_varchar2(buffer));
    offset := offset + buffer_size;
    end loop;
    exception
    when others then
    htp.p(sqlerrm);
    end;
    Step 5.
    Use the PL/SQL cartridge to call the get_img procedure
    OR
    Create that procedure as a function and invoke it within your PL/SQL code to
    place the images appropriately on your HTML page via the PL/SQL toolkit.
    from a html form
    1. Create an HTML form where the image field will be <input type="file">. You also
    need the file MIME type .
    2. Create a procedure receiving the form parameters. The file field will be a Varchar2
    parameter, because you receive the image path not the image itself.
    3. Insert the image file into table using "Create directory NAME as IMAGE_PATH" and
    then use "Insert into TABLE (consecutive, BLOB_OBJECT, MIME_OBJECT) values (sequence.nextval,
    EMPTY_BLOB(), 'GIF' or 'JPEG') returning BLOB_OBJECT, consecutive into variable_blob,
    variable_consecutive.
    4. Load the file into table using:
    dbms_lob.loadfromfile(variable_blob, variable_file_name, dbms_lob.getlength(variable_file_name));
    dbms_lob.fileclose(variable_file_name);
    commit.
    Regards,
    Simma........

  • Problem w/ image item using 9i BLOB field and InterMedia ORDImage Object

    Hi,dear all,
    I have a problem with image item in Form 6i. Oracle 9i is used as backend DB, and a table contains image data is created for testing:
    create table image_test(
    id number,
    image blob
    In Form 6i, there is no problem to create a block for inserting/updating the image record into the database. However, it can not be used to retrieve image (blob field), the image item remains empty after 'execute query', while the id field can be retrieved. When the same table is created in Oracle 8.1.7, and the exact same form can be used without any problem both in inserting and retrieval. It seems that the Oracle 9i does not use the same way to store BLOB column. Has anybody ever encountered this problem? How to retrieve image (BLOB) in Form 6i from Oracle 9i?
    I tried to use interMedia ORDImage as the data type in Oracle 9i, that is,
    create table image_test(
    id number,
    image ORDSYS.ORDImage
    Same problem, the form can insert record with image, but when retrieving, nothing displayed. Anybody could help! Thanks in advance!

    hi!
    well working with oracle8i and form6i.
    same problem..but i used (instead of blob or clob as datatype..) Long raw..
    it can be saved as usual..i mean Commit..
    and can be retrieved..using Execute_Query..its working fine..
    well if anybody get any other solution..do inform..
    mail_id:
    [email protected]

  • Problem building a trigger using a BLOB field in Oracle 10

    My case is the following,
    I'm trying to implement an AFTER trigger which uses the :new.blob_field to insert the new value in a table. Because of the documented AFTER restriction and :new use for blob fields, I've though to add other BEFORE trigger that calls a procedure in which I can store the :new value and later insert the temporary value in the table when the AFTER trigger is executed.
    The Idea is the following:
    BEFORE trigger :new -> TEMP
    and then
    AFTER trigger uses TEMP to store in the new table
    So, the final questions are the following:
    -Any other idea to do the same, that is, to use the ":new" value in an AFTER trigger?
    -How can I do this with the temp variable, is this correct?:
    PROCEDURE store_blob ( new_val BLOB ) IS
    BEGIN
    DBMS_LOB.CREATETEMPORARY(new_blob_temp,TRUE, DBMS_LOB.SESSION);
    -- fill with data
    DBMS_LOB.COPY (new_blob_temp,new_val,DBMS_LOB.GETLENGTH(new_val),1,1);
    END store_blob ;
    Because of the design of the application I have to use the AFTER trigger to store the new value so I must find a solution for this type of fields.
    Sorry for the size of the text and also for my english.
    Thanks in advance

    SQL> create or replace trigger trg1 after insert on test_blob for each row
      2  begin
      3  insert into test_blob2 values (:new.a);
      4  end;
      5  /
    Trigger created.
    SQL> insert into test_blob values ('123456789');
    1 row created.
    SQL> desc test_blob;
    Name                                      Null?    Type
    A                                                  BLOB
    SQL> desc test_blob2
    Name                                      Null?    Type
    A                                                  BLOB
    SQL>
    SQL> select dbms_lob.getlength(a) from  test_blob2;
    DBMS_LOB.GETLENGTH(A)
                        5

  • Problem - insert JSON string into table in CLR function

    Hi
    I create a CLR function to insert JSON string into table.
    With this line 
    mt = JsonConvert.DeserializeObject<MyTable>(jsonStr.ToString());
    The class is OK (no error), but when I try to add the Assembly in Microsoft SQL Server Management Studio, it has error :
    Assembly 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed.' was not found in the SQL catalog.
    (I have Newtonsoft.Json in the Reference)
    Please help !
    Thanks

    Hi Bob
    Could you elaborate a bit more?
    I think the code is ok. The problem is when I deploy the Visual Studio creates/alters the assembly, and get the error
    Error:  SQL72014: .Net SqlClient Data Provider: Msg 6503, Level 16, State 12, Line 1 Assembly 'newtonsoft.json, version=6.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed.' was not found in the SQL catalog.
    ALTER ASSEMBLY [Database1]
        FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C0103000DE411540000000000000000E00002210B010B000012000000060000000000008E3000000020000000400000000000100020000000020000040000000000000006000000000000000080000000020000000000000300608500001000001000000000100000100000000000001000000000000000000000003C3000004F00000000400000A802000000000000000000000000000000000000006000000C000000042F00001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E7465787400000094100000002000000012000000020000000000000000000000000000200000602E72737263000000A8020000004000000004000000140000000000000000000000000000400000402E72656C6F6300000C0000000060000000020000001800000000000000000000000000004
    An error occurred while the batch was being executed.
    Done building project "Database1.sqlproj" -- FAILED.
    This is my FillRow function. Without the bold line, the everything is fine. I can create the assembly, then create the SQL function. Done. When I call select from the SQL function, it returns 10 rows as expected.
    public static IEnumerable getTable(SqlString jsonStr)
            ArrayList resultCollection = new ArrayList();
            MyTable mt;
            //mt = JsonConvert.DeserializeObject<MyTable>(jsonStr.ToString());
            int c = 1;
            while (c < 10)
                mt = new MyTable();
                mt.GlobalId = c.ToString();
                mt.DateSet = "DS=!=" + c.ToString();
                mt.Timestamp = "TS==" + c.ToString();
                mt.PartnerId = "PI==" + c.ToString();
                mt.PartnerUserId = "PUI=" + c.ToString();
                mt.UserIP = "UIP=" + c.ToString();
                mt.UserAgent = "UG=" + c.ToString();
                mt.Referer = "R=" + c.ToString();
                resultCollection.Add(mt);
                c++;
            //resultCollection.Add(mt);
            return resultCollection;

  • Inserting a LONG to a BLOB in the same table

    I have a table with a LONG column and would like to concatenate all existing columns into a new column in the same table and define it as a BLOB. I'm trying to figure out a way to do this. I tried the following and got error message
    insert into cma_search_test
    select obj_id,
         line_id,
         doc_nmbr,
         supplier_part_num,
         mnfctr,
         mnfctr_part_nmbr,
         line_desc,
         ext_desc_txt,
         vend_name,
         cma_effect_dt,
         cma_expir_dt,
         last_updt_usr,
         last_updt_tmsp,
         obj_id||
         line_id||
         doc_nmbr||
         supplier_part_num||
         mnfctr||
         mnfctr_part_nmbr||
         line_desc||
         to_lob(ext_desc_txt)||
         vend_name||
         cma_effect_dt||
         cma_expir_dt||
         last_updt_usr||
         last_updt_tmsp "All_Columns"
    from cma_search
    to_lob(ext_desc_txt)||
    ERROR at line 22:
    ORA-00932: inconsistent datatypes
    Any help would be appreciated.
    Thanks,
    Tracy

    You cannot concatenate a LONG field. You will have to use a procedure to accomplish what you want.
    Use the DBMS_LOB package.

  • Insert XML data into a diferents fiels in a TABLE.

    We have an xml to import in to a table with XMLType of fields.
    The xml file has on field that the content of that field is a full xml file.
    Example.
    <BD>
    <J>
    <T> 1212 </T>
    </J>
    <BDI>
    <INFO><?xml version="1.0" encoding="UTF-8"?> <BuriedDropTask xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="buriedDropSchema.xsd"> <TaskName>UTFS277779</TaskName>.......
    <PhoneNumber>303303033</PhoneNumber>......
    </INFO>
    </BDI>
    </BD>
    This is just an idea and not the actual document.
    We need to insert in a table the data from <J> </J> and some fields of the ineer document like <BuriedDropTask> </BuriedDropTask> to other field in the same table to process the data.
    What is the rigth process to follow?
    The previus programmer was using utl_http.request_pieces to read the xml from an url and acummulated in a varchar2 variable. But the process is not working.
    Thank you for your help in advance.
    Jose Galan

    The XML file with <?xml?> somewhere inside the tags is not valid.
    I think, at first stage the unneeded garbage should be striped of with replace/instr/whatever.
    Then extract() functions should be applied to bulk process the XML.
        insert into tasks (id, t, task_name)
        select tasks_seq.nextval
               t,
               task_name
          from (
            select extractvalue(xml, '//J/T') t,
                   extractvalue(xml, '//BDI/INFO/TaskName') task_name
              from (
                  select extract(xml, '/BD') xml from xml_table
          )

  • Trigger to update field on a table with the sum of fields on another table

    My experience creating triggers and pl/sql in general can best be described in oracle terms as null. I've been practicing by creating tables and applications on my personal home server to help me with some of my work related tasks. Right now I'm trying to create a trigger that will, after insert, update, delete on the assignment_time_track table update the time_spent field on the assignments table with the sum of the time_spent fields on the assignment_time_track table. Hopefully that run on sentence there is clear to people other than myself. I've attempted to script this on my own using the trigger creation tool for Oracle Database Express Edition but I get the following error:
    Trigger create was not successful for the following reason:
    ORA-06552: PL/SQL: Compilation unit analysis terminated ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed
    Here is my attempt at creating the trigger on my own.
    create or replace trigger "ASSIGNMENT_TIME_TRACK_T1"
    AFTER
    insert or update or delete on "ASSIGNMENT_TIME_TRACK"
    for each row
    begin
    update assignments
    set time_spent = (select sum(time_spent)
    from assignment_time_track
    where assignment_time_track.name = assignments.name);
    end;
    If what I've posted isn't clear or more detail is needed, let me know and I'll respond with a complete description of both tables and my goals for each table. Thanks in advance for any help. I will also gladly accept links to tutorials or lessons that explain how to do this sort of thing.
    Edited by: bobonthenet on Mar 9, 2009 2:01 PM

    Hi,
    If the assignments table has only one row per assignment, why is the primary key the combination of name and time_spent? If you have two two assignments called "Lab Report", isn't it possible that you would spend the same amount of time on each of them? I suggest using a sequence to assign an arbitrary id number to each assignment, and use that as the primary key.
    What does each row in assuignment_time_track represent? It sounds like it is a chunk of time spent on one assignment (that is, you want to know that you spent 90 minutes on Tudesday morning working on some assignment, and that you spent another 30 minutes on Tuesday afternoon working on the same assignment). If so, then there should be a foreign key constraint in assignment_time_track referencing the primary key of assignemnt, and not the other way around.
    Alex is right; you can get the total time spent on each project in a query or view; there is no need to replicate that data.
    If you're new to Oracle and SQL, you should invest your time in getting more experience with the basics: everyday things like queries (using joins and GROUP BY) and views, and not spend much time on things that aren't used that much, like triggers.
    If you really did have to copy the data, then you could have a trigger on assignemnt_time_track that kept the total in assignment up to date, like this:
    UPDATE  assignment
    SET     total_time_spent = total_time_spent
                    + NVL (:NEW.time_spent, 0)
                             - NVL (:OLD.time_spent, 0);I suggest you name the column in assignment something different than the column in assignment_time_track, to reduce the risk of confusion. Also, since they represent different things, the same name can't be the most descripttive for each of them.
    In case you're wondering about the use of NVL, above: It allows the same statement to take care of the situation when you INSERT, UPDATE or DELETE a row in assignment_time_track. That is, if you UPDATE a row in assignment_time_track, and change the time_spent from 60 to 90, then you want to add the new time (90) and subtract the old time (60) fro the total_time_spent in assignment: that is, total_time_spent would increase by 30. If you INSERT a new row into assignment_time_track with time_spent=30, you just need to add the new time_spent (30): there is nothing to subtract. But rather than write an IF statement and a second UPDATE for that situation, you can just rely on hte fact that all :OLD values are NULL iwhen INSERTing, and treat that NULL as a 0. Likewise, when DELETing, all :NEW values are NULL..

  • How to update a BLOB column in a table with a file in local machine?

    I have a file (of XML type) in my local machine. I want to update it in a BLOB column of a table in databse server. Can anyone help me in this regard. Appreciate your help.
    Regards
    Walter Nicholas

    user447427 wrote:
    I have a file (of XML type) in my local machine. I want to update it in a BLOB column of a table in databse server. Can anyone help me in this regard.That's the client's job to read data on the client PC (from keyboard/mouse/scanner/file/whatever input) and submit that to the database server for processing and/or storage.
    You cannot expect the server to hack into your PC and lift that data in the file from your disk. Not that is not technically possible. You can wire rockets onto a bicycle to make it go faster, but that's not a wise thing to do. Similarly, it is not a bright idea to ignore the very basics of client-server.
    Bottom line - you need client s/w on your PC to load the content of that file into Oracle. It can be done using SQL*Loader as already suggested. It can be done using a web browser (submitting it via HTTP to web-enabled PL/SQL code). You can use FTP or WebDav and upload into Oracle's XDB (XML database).
    Your requirements will determine what client to use. Once off load? SQL*Loader is very easy to use for loading XML files into the database.

  • Map Lookup Fields of a Table with Portal Iview

    Hello,
    I am creating a MDM Results Set Iview on Portal which is referencing an MDM Table with some fields. One of these fields initself is a Second Table with 3 more fields. I am able to map the Second Table as a Column for Display in the iView as it is there as an Available Column.
    But I want to map just one of the individual field in the Second Table to a Column of iView for Display so that it does not display the other 2 fields of the Second Table. How can I achieve the same in the iview ?
    Any help would be highly appreciated.
    Thanks.

    HI,
    These elements you are talking about can be Tuples or Qualified tables.
    Please follow these  SAP Notes 1325508 (MDM 7.1SP02) and 1364188 (MDM7.1SP03).
    And working with Tuples here:
    http://help.sap.com/saphelp_mdm71/helpdata/en/49/db9b2a175c58c1e10000000a421937/frameset.htm
    Thanks,
    Ravi

Maybe you are looking for