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

Similar Messages

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

  • Error when reading BLOB field from Oracle usin Toplink

    We experience a very annoying problem when trying to read a BLOB
    field from Oracle 8.1.6.2.0 using TOPLink 3.6.3. I have attached the
    exception stack trace that is reported to the console. As far as I can
    judge a fault at oracle.sql.LobPlsqlUtil.plsql_length() happens first and
    then at TOPLink.Private.DatabaseAccess.DatabasePlatform.convertObject().
    The exception is permanently repeating that is very critical for us.
    ServerSession(929808)--Connection(5625701)--SELECT LOBBODY, ID, LABEL, FK_OBJECT_ID, FK_OBJECTTYPE FROM NOTE WHERE (ID = 80020)
    INTERNAL EXCEPTION STACK:
    java.lang.NullPointerException
    at oracle.sql.LobPlsqlUtil.plsql_length(LobPlsqlUtil.java:936)
    at oracle.sql.LobPlsqlUtil.plsql_length(LobPlsqlUtil.java:102)
    at oracle.jdbc.dbaccess.DBAccess.lobLength(DBAccess.java:709)
    at oracle.sql.LobDBAccessImpl.length(LobDBAccessImpl.java:58)
    at oracle.sql.BLOB.length(BLOB.java:71)
    at TOPLink.Private.Helper.ConversionManager.convertObjectToByteArray(ConversionManager.java:309)
    at TOPLink.Private.Helper.ConversionManager.convertObject(ConversionManager.java:166)
    at TOPLink.Private.DatabaseAccess.DatabasePlatform.convertObject(DatabasePlatform.java:594)
    at TOPLink.Public.Mappings.SerializedObjectMapping.getAttributeValue(SerializedObjectMapping.java:43)
    at TOPLink.Public.Mappings.DirectToFieldMapping.valueFromRow(DirectToFieldMapping.java:490)
    at TOPLink.Public.Mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:808)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:173)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:325)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:373)
    at TOPLink.Public.QueryFramework.ReadAllQuery.execute(ReadAllQuery.java:366)
    at TOPLink.Public.QueryFramework.DatabaseQuery.execute(DatabaseQuery.java:406)
    I have started the application with Oracle JDBC logging on and found that the problem may originate in a possible lack of syncronization in the pooled connection implementation:
    DRVR FUNC OracleConnection.isClosed() returned false
    DRVR OPER OracleConnection.close()
    DRVR FUNC OracleConnection.prepareCall(sql)
    DRVR DBG1 SQL: "begin ? := dbms_lob.getLength (?); end;"
    DRVR FUNC DBError.throwSqlException(errNum=73, obj=null)
    DRVR FUNC DBError.findMessage(errNum=73, obj=null)
    DRVR FUNC DBError.throwSqlException(reason="Logical handle no longer valid",
    SQLState=null, vendorCode=17073)
    DRVR OPER OracleConnection.close()
    so the prepareCall() is issued against an already closed connection and the
    call fails.
    I assume we have been using a JDBC 2.0 compliant driver. We tried out
    drivers that Oracle supplies for 8.1.6, 8.1.7 versions. To be true I
    couldn't find any information about the JDBC specification they conform to. Does it
    mean that these drivers may not be 100%-compatible with JDBC 2.0 Spec?
    How can I find out if they are 2.0 compliant?
    Also I have downloaded Oracle 9.2.0.1 JDBC drivers. This seemed to work
    fine until we found another incompatibility which made us return back to
    8.1.7 driver:
    UnitOfWork(7818028)--Connection(4434104)--INSERT INTO STATUSHISTORY (CHANGEDATE, FK_SET_STATUS_ID) VALUES ({ts '2002-10-17 16:46:54.529'}, 2)
    INTERNAL EXCEPTION STACK:
    java.sql.SQLException: ORA-00904: invalid column name
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.jav
    a:2047)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java
    :1940)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatemen
    t.java:2709)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepare
    dStatement.java:589)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeDirectNoSelect(
    DatabaseAccessor.java:906)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeNoSelect(Databa
    seAccessor.java:960)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeCall(DatabaseAc
    cessor.java:819)
    at TOPLink.Public.PublicInterface.UnitOfWork.executeCall(UnitOfWork.java:

    Hello Yury,
    I believe the problem is that TopLink's ServerSession by default executes read queries concurrently on the same connection. It does this to reduce the number of required connections for the read connection pool. Normally this is a good concurrency optimization, however some JDBC drivers have issues when this is done. I had thought that with Oracle JDBC 8.1.7 this issue no longer occurred, but perhaps it is only after version 9. I believe that the errors were only with the thin JDBC driver, not the OCI, so using the OCI driver should also resolve the problem. Using RAW instead of BLOB would also work.
    You can configure TopLink to resolve this problem through using exclusive read connection pooling.
    Example:
    serverSession.useExclusiveReadConnectionPool(int minNumerOfConnections, int maxNumerOfConnections);
    This will ensure that TopLink does not to try to concurrently execute read queries on the same connection.
    I'm not exactly sure what your second problem with the 9.x JDBC drivers is. From the SQL and stack trace it would seem that the driver does not like the JDBC timestamp syntax. You can have TopLink print timestamp in Oracle's native SQL format to resolve this problem.
    Example:
    serverSessoin.getLogin().useNativeSQL();
    Make sure you configure your server session before you login, or if using the TopLink Session Manager perform the customizations through a SessionEventListener-preLogin event.

  • Show photoes using blob field in Oracle DB

    When create Crystal report using Blob field in Oracle 10g DB, the photoes are tif format stored in blod and there are multipages for every record. However in the Crystal Report,it just show the first page of the photo.
    Are there some ways to display all the pages? Or is it necessary to programming using java or .net to display?

    Not capable. CR will only show the first picture and not an album.

  • 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

  • Problem with Pro*C reading BLOB field from Oracle 10g

    Hello Experts,
    We have a Pro*c application which is reading the BLOB data fields (a PNG image file) from Oracle data base. It holds the BLOB fields returned from the SQL query into a Unsigned Char structure in Pro*C. The program used work fine on AIX 32 – bit 4.3 and Oracle 8.1 environment.
    Recently, we have upgraded the environment to AIX 64-bit 5.3 and Oracle 10g.Since after the Pro*c program has problem in reading the Blob filed.
    Below is the query we are trying to execute –
    EXEC SQL
    SELECT
    signtre_image, image_file_name_ext
    INTO
    :msipLocalImage INDICATOR :msipLocalImage_i,
    :file_name_ext INDICATOR :file_name_ext_i
    FROM
    dcs_sign
    WHERE
    signtre_nbr = :signtre_nbr;
    Here signtre_image is the BLOB fields and msipLocalImage is a Pro*C structure define as below –
    typedef struct tagSignImage
    long len; /* Image length */
    unsigned char img[1]; /* Pointer to first byte. */
    } MOTS_SIGN_IMAGE;
    The quesry does not give any error or exception message in the Pro*C , program just stops at the point of executing the quesry..When we run the query commenting the BLOB filed it works fine. Also, the query runs good when we run it in the Oracle editor.
    There seems to be problem with the way we are reading the BLOB field in the new Oracle 10g enviromet.
    Does any body have any idea what’s wrong with this query? We really need it to work.
    Any Help will be greatly appreciated.
    Thanks,
    - Rajan Yadav

    Thanks a ton for your response.
    We made the necessary changes as suggested by you.This time we got another flavour of error - SQL Error Code - Inconsistent error while reading BLOB.
    Another thing we noticed is that the data field which we are trying to read is defined as LONG RAW instead of a BLOB in data base.
    Are these two things related in any sense or is there anything else which is causing the error.
    Once again Thanks for your help.
    - Rajan Yadav

  • Problem building record set using Dreamweaver CS6 Cloud Product

    I am having a problem building a Results Page using Dreamweaver CS6.  I have followed all the steps described in Dreamweaver/Build Search and Results Page Article (multiple times).  It seems that when I save the Results page it does not copy the php used to build the dynamic table.  In fact when I view the source, I do not see any php code. 
    Additionally, when I attempt to bind the record set, it also does not accept the Default Value(s).  Enstead it gives me a list of all data in the colum(s) chosen for the record set (using Where..LIKE..variable definition).
    Any suggestions?
    Regards,
    Norv

    Yes, I will be glad to go through each step.  I will also provide code.
    Step 1:  Built the Search Page by adding Form into exisitng htm page.  Used Insert> Form>Form to insert Form area.  Then added three (3) text fields using Text Icon from the Form Menu Bar (Classic View).
    Step 2: Added a Submit and Reset Button to the Search Page.  Again used the Form Menu Bar to create the Buttons.
    Step 3: Selecte the <form> tag at bottom of Document Window to point Form to the Results Page (using the Action Box.
    Saved page and then began building the Results Page using an existing htm page.  Saved the Results Page as a .php document.
    Results Page:  Here are steps taken to build Results Page (Code will follow):
    1/ On the Results Page created a Recordset using the bindings dialog box.  Used the Advanced Recordset Dialog Box.  In the Advanced Dialog Box I used the Select and Where features to create a Recordset that created a 3 column table (records.County, records.ListPrice, records.PropertyType).  In the Variable box I created 3 variables (varCounty, varListPrice, varPropertyType).  varCounty and varPropertyType parameters are text (Type) and % (for Default Value).  varListPrice parameters are floating point (type) and % (for Default Value).  RunTime Value is $_REQUEST["ColumnName"].
    Here is the Code generated by Dreamweaver.  Note, I am not including the code to access the database, because in all tests I am able to access the table.  In fact first time I built the dynamic table, everything worked and I saw the Colum and default value.  Have never been able to duplicate that effort.  :-)
    Here is code:
    <?php
    if (!function_exists("GetSQLValuestring")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    if (PHP_VERSION<6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) :
    mysql_escape_string($theValue);
    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "". $theValue ."" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "".  $theValue ."" : "NULL";
    break;
    case "defined"
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    return $theValue;
    $varCounty_rslistings = "%";
    if (isset($_GET["County"])) {
    $varCounty_rslistings = $_Get["County"];
    $varListPrice_rslistings = "%";
    if (isset($_GET["ListPrice"])) {
    $varListPrice_rslistings = $_GET["ListPrice"];
    $varPropertyType_rslistings = "%";
    if (isset($_GET["PropertyType"])); {
    $varPropertyType_rslistings = $_GET["PropertyType"];
    mysql_select_db($database_MyDB, $MyDB);
    $query_reslistings = sprintf("SELECT records.County, records.ListPrice, records.PropertyType FROM records WHERE records.County LIKE %s AND records.ListPrice LIKE %s AND records.PropertyType LIKE %s", GetSQLValueString($varCounty_rslistings, "text"),GetSQLValueString($varListPrice_rslistings,"double"),
    GetSQLValueString($varPropertyType_rslistings,"text"));
    $rslistings = mysql_query($query_rslistings, $MyDB) or die(mysql_error());
    $row_rslistings = mysql_fetch_assoc($rslistings);
    $totalRows_rslistings = mysql_num_rows($rslistings);
    ?>
    That's the code that was generated by Dreamweaver. 
    Thanks in advance for your assistance

  • How can i use a blob field in a formula field object

    Hi ,
    We are using Crystal Report Server XI R2.  i have a field "ANSWER" in my datasource which stores value 1 or 0.
    And i have table to store two images as blob fields are "EVALTICKIMAGE" and "EVALCROSSIMAGE".
    Now i need to show an image in my report for the field "ANSWER" instead of 0 or 1.
    So i written a formula to achieve this. my formula text is follows:-
      oFormulaField.Text = @"if {CSP_PROCESS_REPORT.ANSWER} = ""1"" then {EVALIMAGE.EVALTICKIMAGE} else {EVALIMAGE.EVALCROSSIMAGE} ";
    but this does not works for me. i recieve an error "A blob field cannot be used in a formula".
    is there any other way to show images based on a condition.
    or is that possible to use blob fields formulafield, kindly help me.
    Thanks,
    Padmanaban V

    You can use conditional suppression instead.
    Place both image fields on the report. Right click the 1st image field (EVALIMAGE.EVALTICKIMAGE) and choose Format Graphic and make sure the Format Editor is on the Common Tab.
    Click the x-2 button across from Suppress and enter the following formula:
    IF({CSP_PROCESS_REPORT.ANSWER} = 1 THEN FALSE ELSE TRUE
    For EVALIMAGE.EVALCROSSIMAGE, do the same thing except change the formula to:
    IF({CSP_PROCESS_REPORT.ANSWER} = 0 THEN FALSE ELSE TRUE
    Once that's done, you can set one image directly on top of the other.
    HTH,
    Jason

  • Problem inserting Stream or ByteArray into Blob field.

    Hello,
    I am attempting to insert a file that has been converted into a byte array and also an input stream. When the file is less than 50kb it does successfully get inserted into the Blob field. When it is larger, it fails with the following stack trace:
    06/12/07 10:20:57 java.sql.SQLException: Invalid argument(s) in call
    06/12/07 10:20:57 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    06/12/07 10:20:57 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    06/12/07 10:20:57 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    06/12/07 10:20:57 at oracle.jdbc.dbaccess.DBItem.setArrayData(DBItem.java:270)
    06/12/07 10:20:57 at oracle.jdbc.dbaccess.DBItem.setArrayData(DBItem.java:246)
    06/12/07 10:20:57 at oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2484)
    06/12/07 10:20:57 at oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1219)
    06/12/07 10:20:57 at oracle.jdbc.driver.OraclePreparedStatement.setBytes(OraclePreparedStatement.java:2307)
    06/12/07 10:20:57 at com.evermind.sql.PreparedStatementBCELProxy.setBytes(PreparedStatementBCELProxy.java:201)
    06/12/07 10:20:57 at mil.dla.finance.issueTracker.AbstractIssueTrackerAction.insertNewIssueItem(AbstractIssueTrackerAction.java:265)
    06/12/07 10:20:57 at mil.dla.finance.issueTracker.WriteIssueAction.execute(WriteIssueAction.java:181)
    06/12/07 10:20:57 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    06/12/07 10:20:57 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    06/12/07 10:20:57 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    06/12/07 10:20:57 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    06/12/07 10:20:57 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    06/12/07 10:20:57 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    06/12/07 10:20:57 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    06/12/07 10:20:57 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    06/12/07 10:20:57 at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    06/12/07 10:20:57 at mil.dla.finance.common.filters.UserAuthFilter.doFilter(UserAuthFilter.java:201)
    06/12/07 10:20:57 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)
    06/12/07 10:20:57 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
    06/12/07 10:20:57 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    06/12/07 10:20:57 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    06/12/07 10:20:57 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    06/12/07 10:20:57 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    06/12/07 10:20:57 at java.lang.Thread.run(Thread.java:534)
    Any assistance would be greatly appreciated.

    I thought I had found the answer here: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/lob/LobToSP.html
    I adapted the Clob code to a Blob:
    private BLOB getBLOB( byte[] array)
    throws Exception {
    BLOB b = null;
    try {
    // create a new temporary BLOB
    b = BLOB.createTemporary( conn, true, BLOB.DURATION_SESSION );
    // Open the temporary BLOBin readwrite mode to enable writing
    b.open( BLOB.MODE_READWRITE );
    b.setBytes(array);
    // Get the output stream to write
    } catch ( Exception exp ) {
         // Free BLOB object
    b.freeTemporary( );
    // do something
    return b;
    however, it appears that the BLOB being returned is null, and when sent to the DB, nothing is actually written. So any help/suggestions would be greatly appreciated.
    Message was edited by:
    SFBell09

  • Access BLOB field in Oracle database

    Dear Sir,
    I am using Pro* C to access oracle blob fields
    I write "12345" to Oracle Blob field, when I read it it is fine.
    I then modify this record to "ABC", when I read it, I get "ABC45",
    How can I set blob field to the initial state to modify BLOB field correctly ?
    Many Thanks
    Liang

    Initially you write 12345 and when you modify you are modiyfing only 3 bytes from offset 1 and hence the results. When you modify oracle will not erase the complete lob you need to use erase before you modify (write)
    Following doc give you an insight into pl/sql lob functions
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lob.htm#sthref4428
    Following is the Pro*C Lobs Guide
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28427/pc_16lob.htm#i998068

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

  • Problem building applicatio​n using Report Generation Toolkit, LV 2011

    I'm using LabVIEW 2011 under Windows 7.
    I tried to use Application Builder to create an executable from a large body of code. One thing the application does is load VIs into a subpanel and run them.
    Application Builder created the executable and gave no error message. The built application ran except that it couldn't run any of the dynamic VIs.
    I finally succeeded in doing a screen grab on a transient dialog (about 1/10 sec. appearance). The dialog showed an attempt to load <vilib>:\Utility\NIReport.llb\NI_report.lvclass.
    In one dynamic VI I commented out the call to the only VI that uses the Report Generation Toolkit (called only from dynamic VIs, all of which call it). Sure enough, when I built the application with that change and ran it, the dynamic VI that didn't invoke the Report Generation Toolkit did successfully load into the subpanel and run.
    So, trying to prove to myself that that was the only problem, I wrote a VI that does nothing but load a VI into a subpanel and run it. User can choose one of two VIs: one that doesn't call the Report Generation Toolkit (or do much of anything), and one that does. Both VIs run fine standalone.
    The not-much-of-anything VI loaded and ran in the subpanel. The other VI didn't--the same dialog, mentioned above, popped up for 1/10 second or less. Screen grab is attached.
    When I included LVClass and NIReport.llb folders in the project (from vi.lib\Utility: Snapshot folders), and "Always Included" those folders (per a suggestion on this forum from a few years ago), the result was the same. The result was also the same when I included either one of those folders but not the other. Likewise it doesn't matter whether I add the dynamic VIs as "Always Included" or not.
    Another piece of information that may be pertinent: when adding the NIReport.llb folder, I got a message that it was impossible to add a certain VI that's part of some report-type class, because a VI of that name already existed in the project. Screenshot of that dialog is also attached.
    VIs and project file are also attached along with the two screenshots. I hardcoded VI paths, so put everything into C:\Testing if you want to see what the code does--or hack as desired, etc.
    I will be deeply grateful for any help! And I apologize in advance if there's already some exact or close-enough solution posted--but I doubt there is. I looked around.
    Thanks very much,
    mws
    Attachments:
    Test-App-Build.zip ‏336 KB

    Hi again,
    If you extract all files in the original zip attachment to a folder called C:\Testing on a Windows 7 machine running LV 2011, and then use the build script within the project file to build the application, you can run the application and see what happens. You can also play around with the build parameters, rebuild, run, and see what happens then. You can also open my VIs and see what I'm doing.
    The application lets you pick one of two dynamic VIs to run in a subpanel. One VI contains calls both to Report Generation VIs and some functions from the Advanced File Functions palette. The other VI does not.
    When you pick the first VI to load and run (the one with the Report Generation and Advanced File Functions calls), it loads into the subpanel but is not executable.
    When you pick the second VI to load and run, it does load into the subpanel and execute. So there's nothing wrong with the way I load and run a VI in the subpanel.
    In the development environment, the whole thing runs with no problems.
    Evidently the built application has problems resolving paths of something called by Report Generation VIs and by the Advanced File Functions I use.
    I've done a lot of experimenting and no luck. I've looked in forum archives, etc. etc., for possible solutions. I'm hoping there's some simple solution I've missed.
    Thanks very much for any help!

  • Problems building a graph using sql SUM

    Hello !
    i'm curently having issues to build a particular graph :
    First, i have a database (moves) which contains 2 columns (timestamp DATETIME, dist NUMERIC), i have no problems to display a graph with these values (even using a time range such 'now','-1 hours', etc.).
    But i'd like to build a graph with for example a 2 hours range which gonna display the sum of the value 'dist' every 30 seconds. So for example, if i have 2 'dist' values (3 and 4) at 0min 30sec, the graph will display 7 and the next value will be the sum of
    the next 30 secondes dist values.
    I tried this :
    curs.execute("SELECT timestamp,SUM(dist) AS dist30 FROM moves WHERE timestamp>datetime('now','-30secondes')"
    curs.execute("SELECT timestamp,dist30 FROM moves WHERE timestamp>datetime('now','-1 hours')"
    But it looks like the column dist30 is not created, and i think this is not gonna work if i want to change the 1 hour range...
    I would like a better "algorythme", the table is filled in an other program, should i directly create a 3  columns table and SUM the dist in dist30 directly ?
    Thanks for your advice !

    Hi Subby,
    Regarding your description, are you trying to rollup the dist column by every 30 seconds in a given 2 hours range? If my understanding I correct, you may reference the below sample. As you didn't post any detail about your function datetime(after the where
    clause), so the sample is just in a usual way.
    CREATE TABLE moves(timestamp DATETIME, dist NUMERIC)
    INSERT INTO moves VALUES('2015-02-13 14:20:01',1)
    INSERT INTO moves VALUES('2015-02-13 14:20:17',2)
    INSERT INTO moves VALUES('2015-02-13 14:20:29',5)
    INSERT INTO moves VALUES('2015-02-13 14:22:37',2)
    INSERT INTO moves VALUES('2015-02-13 14:22:56',5)
    INSERT INTO moves VALUES('2015-02-13 14:27:17',2)
    SELECT timestamp,SUM(dist) AS dist30 FROM(
    SELECT DATEADD(SECOND,DATEPART(SECOND,timestamp)%30*-1,timestamp) AS timestamp,dist FROM moves) AS T --rollup by every 30 seconds
    WHERE timestamp BETWEEN '2015-02-13 13:00:00' AND '2015-02-13 15:00:00' --two hour range
    GROUP BY timestamp
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Problem while changing the query of the field in Oracle apps 11.5.10

    Hello All,
    Requirement:
    User want to change the query of the LOV attached to Ordered item field on Line items tab on the Sales order form in Order managment
    Block name = 'LINE'
    Field name = 'ORDERED_ITEM_DSP'
    LOV attached to this field in FMB: ITEMS
    LOV attached to this field in front end: ENABLE_LIST_LAMP
    Problem: Following code is firing at all points (Debug messages are appearing at all points) but Query of the LOV attached to item is still same.
    How can in FMB LOV is "ITEMS" and in front end "ENABLE_LIST_LAMP"
    My guess is there is some problem with the LOV name which we are passing in the code below. Because LOV name attached to item are different in front end and FMB. There is no LOV in FMB which has “SYSTEM ITEMS Description” kind of structure.
    I have written following code in custom.pll (l_chr_rg_query is query taken from the record group attached to “ITEMS” named LOV with some modifications ex: rownum<6 so that it will show only 6 records in LOV if it is really firing our query for LOV)
    IF ( form_name = ‘OEXOEORD’
    AND block_name = ‘LINE’
    AND field_name = ‘ORDERED_ITEM_DSP’
    AND event_name = ‘WHEN-NEW-ITEM-INSTANCE’
    THEN
    MESSAGE (‘message1’);
    l_chr_rg_name := ‘XXLION_UNIFORM_CODE_RG’;
    l_chr_rg_query :=
    ‘SELECT item, item_id, item_description, inventory_item_id,item_identifier_type,null           item_identifier_type_meaning, ‘
    || ‘inventory_item, address, cust_address, item_definition_level ‘
    || ‘FROM oe_return_items_v ‘
    || ‘WHERE (sold_to_org_id = :parameter.lov_num_param1 OR sold_to_org_id IS NULL)’
    || ‘ and rownum < 6 ORDER BY item’;
    MESSAGE (‘message2’);
    l_rg_id := FIND_GROUP (l_chr_rg_name);
    MESSAGE (‘message3’);
    IF ID_NULL (l_rg_id)
    THEN
    MESSAGE (‘Creating record group here’);
    l_rg_id :=
    CREATE_GROUP_FROM_QUERY (l_chr_rg_name, l_chr_rg_query);
    END IF;
    errcode := POPULATE_GROUP (l_rg_id);
    MESSAGE (‘ERROCODE is : ‘ || errcode);
    L_lov_id := FIND_LOV (‘ITEMS’); --My guess is this LOV name is the source of problem.
    MESSAGE ('Error code is4');
    SET_LOV_PROPERTY (l_lov_id, group_name, l_rg_id);
    MESSAGE ('Error code is5');
    SET_ITEM_PROPERTY ('LINE.ORDERED_ITEM_DSP', lov_name, 'ITEMS');
    END IF;

    I found that there is no problem with code. My problem is not technical, its a functional problem.
    It is related to Inventory's "System Items" KFF.
    Can anybody tell me, to this "System Items" KFF, one value set is assigned. but it is of none type of value set. so from where the values in LOV are coming?

  • How can i store image into blob field in oracle express ??

    Hi
    am using oracle express *(2.1)* , i am devloping a small system , we have to store an image in blob filed in a table, we have to create a form which allow the user to store the image in the table and to generate a report contains the image
    any note's please
    tahnk's in advance
    sam
    Edited by: user485341 on Dec 22, 2008 1:28 AM

    hi Andy
    this is the code for download
    create or replace PROCEDURE download_my_file(p_file in number) AS
    v_mime VARCHAR2(48);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    Lob_loc BLOB;
    BEGIN
    SELECT MIME_TYPE, BLOB_CONTENT, FILE_NAME,DBMS_LOB.GETLENGTH(BLOB_CONTENT)
    INTO v_mime,lob_loc,v_file_name,v_length
    FROM A_IMAGES
    WHERE IMAGE_ID = p_file;
    owa_util.mime_header( nvl(v_mime,'application/octet'),FALSE );
    -- set the size so the browser knows how much to download
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment;
    filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1)
    ,chr(10),null),chr(13),null)|| '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( Lob_loc );
    end download_my_file;
    thank's

Maybe you are looking for

  • How can I use this arrray?

    I have written arguemnts to add severals shapes to the scene(by using createVrmlFromString()), all the shape nodes stored in shapeArray[], now I'd like to use another array(b[]) to get the index of each shape nodes which has been added to the secne,

  • Help needed in calculations in Workbook for input query

    hi friends , Iam displaying an input query in the Workbook ..the format of the query is Account                                  Amount 1010 Undistributed Amount     $ 2000 1010 PC1 1010 PC2 1010 PC3 The use 0f this query is to distribute the undistr

  • How to change device names?

    This questions revolves around three V490s. - All are connected to the same raid. - All have cards in the same slots. - One box had only 1 internal drive, two came with 2 internal drives. - All have stmsboot enabled. - When doing a format, 2 boxes sh

  • Workflow org unit and event create

    hi gurus, I am using a standard sap workflow for travel. I am having two issues with it: 1. I created an org structure for it. But when I give the org structure name in the workflow it is not picking up the manager's name and not sending the email. B

  • LR or PS for best uprezzing - confused

    Just read the excellent article "The Right Resolution" by Jeff Schewe in DigitalPhotoPro. But it has left me with a question: I have a (new) Epson R3000, so I want to print my images at 360ppi. 0. Using Photoshop CS5, I can use Image Resize to set th