Prepare statement to insert a row that contains Blob column. Which way is correct?

When we make prepare statement to insert a row that contains Blob column. Which way is correct? And what is the difference? Does anyone know?
     1.  Preparestatement.setBlob(parameter number, blob type object)
     2. Preparestatement.setBlob(parameter number, inputstream type object)
This link show the test I made.
https://community.oracle.com/thread/3680185?sr=inbox&customTheme=otn

When we make prepare statement to insert a row that contains Blob column. Which way is correct? And what is the difference? Does anyone know?
     1.  Preparestatement.setBlob(parameter number, blob type object)
     2. Preparestatement.setBlob(parameter number, inputstream type object)
I answered that in your other thread and provided a link to the JDBC Dev Guide section that discusses how to work with LOBs and BFILEs.
Did you read that doc section?
Did you read my reply in your other thread?
In java a BLOB is just the locator that gives you access to the actual content. In your case you got access by selecting an existing BLOB locator and getting its inputstream. That inputstream is what gives you access to the actual blob content.
The locator is just that; it specifies the LOCATION of the blob content but it is NOT the content.

Similar Messages

  • Supress Missing Blocks : Suppressing rows that contains data

    Hi,
    In Hyperion Planning 11.1.2.2, on a webform if I do supress missing blocks, it suppresses rows that contains data also (for 3 particular members of the dimension selected in the row).
    This webform is otherwise a huge report & if I do not check on supress missing blocks, the application hangs on trying to open this report (webform).
    Summarizing, on selecting supress missing blocks, it should bring me data for 90 members but it is currently displaying results for 87 members.
    Thanks in Advance.
    Pawan.
    [email protected]__

    Are you definitely sure there are no blocks for those members, maybe there is data but it is just set as #missing and the blocks have not been removed.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • I can't import a table contains BLOB column  from one user to another user.

    1) I create two user both have connect role,and each has its own tablespace, DDL:
    create user d2zd identified by d2zd default tablespace d2zd quota unlimited on d2zd account unlock;
    grant connect to d2zd;
    create user d3zd identified by d3zd default tablespace d3zd quota unlimited on d3zd account unlock;
    grant connect to d3zd;
    2)Then enter oracle as d2zd and create a table contains BLOB column and insert data to the table.
    3) export d2zd as follow:
    exp d2zd/d2zd file=d2zd.dmp
    4) import to d3zd as follow:
    imp d3zd/d3zd fromuser=d2zd touser=d3zd file=d2zd.dmp
    the question is the table with BOLB colum can't be import,
    it says:have no privilege on tablespace d2zd.
    How can I import a table contains BLOB column from one user to another user?

    Hi - the reason for as our friend already told ist that a blob can be stored outside of the table segment, in another Tablespace, This is for performance reason.
    Sou you would need to have Quota on two tablespaces.
    the one which holds the table segment the other which holds the blob(segment).
    Regards
    Carl
    Message was edited by:
    kreitsch

  • ESS Error- Data source contains no columns which can be displayed

    Hi
      After the application of support packs, an error is observed in ESS applications where the data/content has to be displayed in tabular format.
      On accessing Personal Data application, error message is displayed -
       Error Occured
       Data source contains no columns which can be displayed
       Screenshot is also attached for reference.
       Please help in resolving the issue.
    Regards
    Shaily

    Hi all!
    I have the same problem, any ideas how to analyze and solve the problem?
    Regards
    Peter Meyer

  • How do I get a sum of cells for rows that contain a text in a drop down menu?

    I am trying to track individual sales with each of my vendors. I have a column of drop down menu's that list each of my vendors. I am trying to associate a dollar amount for a single transaction in a row that is associated with a vendor and get a sum for all of my single trasactions with that vendor for the year. I have used =countif to build a pie chart of % of transactions per vendor now I am trying to get a dollar amount as well
    Thanks in advance
    Don

    HI Don,
    COUNTIF will count, SUMIF will sum.
    The main difference between them is that COUNTIF works with data in a single column—in this case the column containing the vendor names—while SUMIF uses two columns—the vendor names to decide which rows to include in the sums and the amount column to determine the amount to incude.
    Example:
    Main: Vendor names in column A, descriptions in columns B and C, and dollar amounts in column D
    Summary: Vendor names in column A, Number of transactions in column B, Dollar totals in column C
    Formulas inn Summary (both are entered in row 2 and filled doen to the last row):
    B2: =COUNTIF(Main :: $A,A2)
    C2: =SUMIF(Main :: $A,A2,Main :: $D)
    Regards,
    Barry

  • Finding tables that contain a column

    Hi all,
    I am a relatively new SQL user and am trying to figure out how to find all tables that contain a particular column, eg, 'cust_id'. I have tried a bunch of different things and searched on Google but I think I don't quite have/understand the syntax I need.
    Also, how would I display a list of all the columns in all the tables?
    Thanks!

    Hi,
    apex wrote:
    Thanks for the input! I got my first question working.
    I am still trying to understand basic ideas in SQL, eg what is the all_tab_columns in Raj's link, as usually I call something from a particular table. All_tab_columns is a view in the sys schema. There are several tables and views in the sys schema whose names start with user_ or all_ (or dba_, but you may not have privileges to see those) which are collectively called the Data Dictionary . They contain information about the database itself, including the tables in the database.
    It states there that the ANALYZE command can be used to gather statistics for this view, but I have not been able to get it working.
    Eg, in Oracle SQL Developer, I type in "help <analyze>" but it doesn't tell me what the syntax of this command is, I had to use Google which gives the following
    To estimate statistics:
    ANALYZE TABLE tablename ESTIMATE STATISTICS SAMPLE 30 PERCENT;
    To compute statistics:
    ANALYZE TABLE tablename COMPUTE STATISTICS;
    But when I try the last one it just says
    table CUSTOMERS analyzed.
    but I don't see any output, and if I try to use ANALYZE all_tab_columns; it gives me an error message. When you analyze a table, a message like "table CUSTOMERS analyzed" is all you expect to see. The main purpose of anlyzing isn't to produce a report for you to read (as helpful as thant might be) but to update the data dictionary, so that Oracle knows how to do queries efficiently. For example, if you have a query like
    SELECT  *
    FROM    patients
    WHERE   birth_date  = DATE '1981-07-28'
    AND     state_abbr  = 'NY';How does the system decide whether to look for rows with the right birth_date first, or the right state? The statistics in the data dictionary might tell it that birth_date has many more ditinct values, so looking for a particular birth_date first will narrow down the search much faster than looking for a particular state.
    By the way, the ANALYZE command has been deprecated. Unless you're using a very old version of Oracle, you should be calling the dbms_stats package instead:
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_stats.htm#CIHBIEII
    I am using Sam's teach yourself SQL in 10 minutes which is very good at the very specific commands and functions it describes but doesn't really orient me to the language, doesn't explain how to use the help functions, or any treatment of tasks not contanied in the book. If someone can recommend another source would appreciate it. Much thanks!That's the frustrating thing about books; you can't ask them questions. (On the other hand, that's one of the nice things about this forum.)
    I can understand why the book doesn't say much about analyzing. The book is about SQL (e.g., how to create a table or write a query). Statistics are not in the scope of that book. Actually, they're not really in the scope of this forum, either. If you have questions about statistics, you're better off posting them in the "Database - General" forum:
    General Database Discussions

  • 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

  • Error when inserting  file 4KB in a BLOB column.

    Hello,
    I am getting the following error when I am trying to insert a file > 4KB in a
    BLOB column.
    ORA-01461: can bind a LONG value only for insert into a LONG column.
    We are using Weblogic5.1.0 sp10, Oracle 8.0.5 with WL OCI driver.
    There is no change even after setting the following property weblogic.oci.min_bind_size=660
    Please can anyone help?
    Thanks.

    Hello,
    I tried using the following sql stmts to override the NLS_LANG setting on both
    server and client for a session.
    ALTER SESSION SET NLS_LANGUAGE = AMERICAN;
    ALTER SESSION SET NLS_TERRITORY = AMERICA;
    It still gave the same error.
    I tried the same using Oracle thin driver.Even then the same problem.
    As I mentioned earlier, we are using oracle 8.0.5.
    and here is the code I am using for writing BLOB data
    java.sql.PreparedStatement prepstmt = conn.prepareStatement("Update TEST_BLOB
    set BLOBATTACH = ? where IDX =1");
    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
    ObjectOutputStream p = new ObjectOutputStream(ostream);
    p.writeObject(data);
    prepstmt.setBinaryStream(1, new ByteArrayInputStream(ostream.toByteArray()), ostream.size());
    prepstmt.executeUpdate();
    prepstmt.close();
    Any suggestions ?
    Thanks.
    "Slava Imeshev" <[email protected]> wrote:
    Latha,
    You need to make sure you have the same NLS_LANG setting both for the
    client
    and the server.
    Regards,
    Slava Imeshev
    "Latha Pusapaty" <[email protected]> wrote in message
    news:[email protected]...
    I Tried that. But still getting the same exception.
    java.sql.SQLException: ORA-01461: can bind a LONG value only for insertinto a
    LONG column
    at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    at weblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java:980)
    atweblogic.jdbc20.pool.PreparedStatement.executeUpdate(PreparedStatement.java:
    47)
    atweblogic.jdbc20.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedSta
    tementImpl.java:54)
    atweblogic.jdbc20.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStat
    ement.java:55)
    at fictx.TRServlet.doPost(TRServlet.java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, CompiledCode)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, CompiledCode)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    Compiled Code)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java,
    Compiled Code)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java,
    Compiled Code)
    atweblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java,
    Compiled Code)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,Compiled
    Code)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,Compiled
    Code)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
    Same code is working fine for files less than 4000 bytes.
    Oracle table has only one BLOB column.
    I have set weblogic.oci.selectBlobChunkSize=1200 .
    Where could be the problem?
    Andreas Bittorf <[email protected]> wrote:
    We resolved the problem as following:
    ps = con.prepareStatement
    ("update tq_businessmodel set
    businessmodel=?,lastupdate=?
    "WHERE taskid=?");
    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
    ObjectOutputStream p = new ObjectOutputStream(ostream);
    p.writeObject(businessModel);
    ps.setBinaryStream(1, newByteArrayInputStream(ostream.toByteArray()),
    ostream.size());
    ps.setTimestamp(2,new Timestamp(System.currentTimeMillis()));
    ps.setLong(3,taskid);
    ps.executeUpdate();

  • 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

  • Select query taking 30 sec to fetch data from table containing BLOB column.

    Hi Friends,<o:p></o:p>
    Please help me...<o:p></o:p>
    I have 15 columns in a table, in that 2 columns containing blob (images).<o:p></o:p>
    More than 22 lakhs records are in a table.<o:p></o:p>
    While i am try to fetch data from this table it nearly takes 25~30 sec to execute that query.<o:p></o:p>
    When i deleted the two columns containing blob and i tried its executing fast .<o:p></o:p>
    I should not change the table schema.<o:p></o:p>
    Views also i created and indexes also there in a table.<o:p></o:p>
    How can i improve the query execution speed?.<o:p></o:p>

    And how large is the size of BLOB data in your table? If it's several giga bytes, then the time is simply required to read the amount of data from disk and to transfer it to the Client.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Can I sort a column based upon a "find" word?  i.e. I want to group all the rows that contain a certain word.  I'm using Numbers '09 on a Macbook Pro.  Thanks for your help!

    A second question: I am creating a database of products for my point of sale system.  I am using a product list sent to me by a vendor.  Can I pull out certain words in their description and add them to a new column.  i.e. The vendors' description in one cell is "Blueridge Guitar Dreadnought."  Can I automatically add the word "Dreadnought" to a new column in the same row?

    You can extract the word case where the string contains case using
    =IFERROR(IF(FIND("CASE",B)>0,"CASE",""),"")
    But that doesn't solve the issue of what goes in that column for lines where the product ins not a case.
    Looking at the other columns, I don't see a means of getting "Hardshell" from the given data using a formula.
    A semi-manual method using the "Show rows... feature of the Reorganize panel might prove efficient.
    Here, the Show rows... displayd was applied, then CASE was entered in the first cell in column A and filled down to the last visible cell. As can be seen below, the fill operation placed "CASE" in only the rows where column B containsed "CASE".
    Regards,
    Barry

  • Select Query to fetch rows that contain non alphabetic characters

    how to select rows from a table (tab1) where a specific column (tab1.col1) has non alphabetic characters

    hi,
    you didnt specify which version you are using.
    if you are working on oracle 10g you can use regular expressions like this:
    select * from tab1 where regexp_like(col1,'[^[[:alpha:]]]');

  • How I can insert one row on table,  with columns settings: readonly = true

    I have a problem. (jdeveloper 11.1.1.2.0)
    How I can insert row on table (EditingMode= clickToEdit), with columns settings: ReadOnly = true.
    When I make click on button create insert, ADF create one row on the table with output text invisible ( ReadOnly = true.)
    I make double click, then output text is visible (ReadOnly = false)
    I dont want make double click. I want output text is visible (ReadOnly = false), when I make click on button create insert
    Thanks

    Hi,
    try changing the edit mode of the table when pressing the button and refresh the button. This of course turns the whole table into editable mode, but this is how it needs to work. Alternatively, you create an input form for the user to edit the new record and show the form in a popup or beneath the table. Then when the user submits the created row data, you refresh the table to shwo the new row
    Frank

  • Cfquery of MVS DB2 table containing BLOB Column

    Using ColdFusion MX 7. Able to convert the BLOB into a string
    when the data source is in UDB (Our development Database) however
    when the data source changes to MVS DB2 (Staging and Production
    Databases) the template no longer renders the data to the screen.
    code snippet from template:
    <cfoutput>
    <cfquery name="acct_selector"
    datasource="#request.ds#">
    SELECT DISTINCT * from dbo.Account
    where cf_token = '#cftoken#' and cf_pid = '#cfid#' and
    account_system!='I'
    order by account_num
    </cfquery>
    <cfset acctname=arraynew(1)>
    <cfset acctnumb=arraynew(1)>
    <cfset i=1>
    <cfloop query="acct_selector">
    <cfset acctname
    =account_name>
    <cfset acctnumb=account_num>
    <cfset i=i+1>
    </cfloop>
    <cfset
    rpdt1=dateformat(sDate,"yyyy-mm-dd")&"-00.00.00.000000">
    <cfset
    rpdt2=dateformat(sDate,"yyyy-mm-dd")&"-23.59.59.999999">
    <cfquery name="reflexReport"
    datasource="#request.db2#">
    select
    reflex_rpt_id,account_num,report_tmstp,sequence_num,fk_report_typ,report_txt
    from #request.db2qlfr#.gzb005_reflex_rpt
    where (<cfloop
    query="acct_selector">account_num='#account_num#' or
    </cfloop> account_num='0')
    and report_tmstp>='#rpdt1#' and
    report_tmstp<='#rpdt2#'
    </cfquery>
    </cfoutput>
    <cfif reflexReport.recordcount gt 0>
    ... (report headers built here) ....
    <cfoutput query="reflexReport">
    <cfset rpdata=tostring(report_txt)>
    I know there are rows being selected into the cursor because
    the headers are displaying on the browser page. If no rows are
    selected the process pops up an alert window tells the user there
    is no report data for the date selected.

    Well, I'm not familiar with DB2, but I've done a little
    research and from what I've found is that to resolve the problem
    you must do a rebind on the database. This typically happens if a
    Fixpack was applied. More information about rebinding bind files
    can be found in the Fixpakreadme.txt
    I hope this is applicable and does the trick for you.

  • SELECT-INTO prepared statement?

    Hi,
    I have a single-row select to execute. I don't know if the multi-row select functionality (ResultSets, etc.) should be used for a single-select.
    Here's from the Oracle JDBC Documentation on a prepared statement with input variables:
    PreparedStatement pstmt =
    conn.prepareStatement ("insert into EMP (EMPNO, ENAME) values (?, ?)");
    pstmt.setInt (1, 1500); // The first ? is for EMPNO
    pstmt.setString (2, "LESLIE"); // The second ? is for ENAME
    pstmt.execute ();
    What I would like to do is have a PreparedStatement for output variables in a SELECT-INTO:
    pstmt= conn.prepareStatement("select max(sal) into ? from emp;");
    but there appears to be no bind variable functionality.
    Callable statements apparently are only for stored procedures.
    Basically, should I just use the multirow select for this?
    Thanks,
    Glen

    pstmt= conn.prepareStatement("select max(sal) into ?
    from emp;");
    but there appears to be no bind variable
    functionality.You might be able to bind this as an output parameter, but it seems like extra work (just getting a ResultSet for "select max(sal) from emp" would be a lot more straight forward).
    >
    Callable statements apparently are only for stored
    procedures.Not really, I execute PL/SQL blocks using prepared statements all the time. Sometimes it's the only way to get the data into a format that JDBC can handle.
    Here's an example:
        /** This is the SQL used to call the API ... */
        public static final String spSQL =  
        "declare " +
            "t_warranty_tbl apps.cib_devo_wrapper.wartbltyp; " +
            "x_warranty_tbl apps.cib_devo_wartbltyp; " +
            "x_return_text VARCHAR2(2000); " +
        "begin " +
            "apps.cib_devo_wrapper.cib_get_warranty_info(" +
                "P_SERIAL_NUMBER => ?,"
                "X_WARRANTY_TBL => t_warranty_tbl," +
                "X_RETURN_TEXT => x_return_text," +
                "x_row_count => ?); " +
            // Convert to a table of objects ...
            "x_warranty_tbl := apps.cib_devo_wrapper.cib_warranty_casttowartbltyp(t_warranty_tbl); " +
            // Get the cursor with order by ...
            "OPEN ? FOR SELECT * FROM TABLE(CAST(x_warranty_tbl AS apps.CIB_DEVO_WarTblTyp)) tbl " +
                "WHERE tbl.entitlementReturnCode != apps.cib_devo_wrapper.g_ent_ret_code_08 " +
                "ORDER BY tbl.INSTALLEDAT_CUSTOMER_NAME, tbl.SITE_NAME, tbl.SITE_ID, " +
                          "tbl.PRODUCT_FAMILY, tbl.PRODUCT_NAME, tbl.SERIAL_NUMBER; " +
           "?:=x_return_text; " +
        "end;";In this example, I declare a few variables, call a stored procedure,
    do some more PL/SQL to reduce the results before I finally bring them back.
    The first placeholder (question mark) is the input serial number, the second one is an output parameter that gives the row count. The third
    question mark is the cursor that contains the data I need, and the fourth is a reference to a status message.
    As you can see, the PL/SQL isn't exclusively stored procedure calls.
    >
    Basically, should I just use the multirow select for
    this?I think you'd need code that looks something like:
    DECLARE
    myCount NUMBER;
    BEGIN
    select max(sal) into myCount
    from emp;
    ? := myCount
    END;Although wrapping the select in a BEGIN..END block may be enough.

Maybe you are looking for