Distinct and Blob

hi everybody,
one question why doesn't work a select statement like:
select distinct asset_id,keyframe from vir_keyframes;
asset_id a number and indicates the blob for further work, the value can be more than one time in the database
keyframe a blob
how am i able to get only records as result where only different asset_id's are displayed.
thanks for helping
tommyO

user644122 wrote:
hii,
Is there any difference between distinct and unique in sql...Read the following blog post
http://mhabib.wordpress.com/2007/03/09/what-is-difference-between-distinct-and-unique/
And check this thread:
Difference between UNIQUE  and DISTINCT

Similar Messages

  • Poor performance when Distinct and Order By Used

    Hello,
    I am getting an slow answer when I add Distinct and Order By to the query:
    Without Distinct and Order By lasts 3.57 seconds; without Distinct and Order By lasts 28.15 seconds, which it's too much for our app.
    The query is:
    select distinct CC.acceso, CC.ext_acceso, TIT.TITULO_SALIDA
    from (((Ocurrencias CT01 inner join
    palabras p0 on (CT01.cod_palabra = p0.cod_palabra and p0.palabra like 'VENEZUELA%' AND p0.campo = 'AUTOR')) INNER JOIN
    CENTRAL CC ON (CT01.ACCESO = CC.ACCESO AND CT01.EXT_ACCESO = CC.EXT_ACCESO))) inner join
    codtit ctt on (CC.acceso = ctt.acceso and CC.ext_acceso = ctt.ext_acceso) inner join
    titulos tit on (ctt.cod_titulo = tit.cod_titulo and ctt.portada = '1')
    where CC.nivel_reg <> 's'
    ORDER BY 3 ASC;
    The query plan for the query WITH Distinct and Order By is:
    Elapsed: 00:00:28.15
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=301 Card=47 Bytes=12220)
    1 0 SORT (ORDER BY) (Cost=301 Card=47 Bytes=12220)
    2 1 SORT (UNIQUE) (Cost=300 Card=47 Bytes=12220)
    3 2 NESTED LOOPS (Cost=299 Card=47 Bytes=12220)
    4 3 NESTED LOOPS (Cost=250 Card=49 Bytes=4165)
    5 4 NESTED LOOPS (Cost=103 Card=49 Bytes=2989)
    6 5 NESTED LOOPS (Cost=5 Card=49 Bytes=1960)
    7 6 TABLE ACCESS (BY INDEX ROWID) OF 'PALABRAS' (TABLE) (Cost=3 Card=1 Bytes=19)
    8 7 INDEX (RANGE SCAN) OF 'PALABRA' (INDEX (UNIQUE)) (Cost=2 Card=1)
    9 6 INDEX (RANGE SCAN) OF 'PK_OCURRENCIAS' (INDEX (UNIQUE)) (Cost=2 Card=140 Bytes=2940)
    10 5 TABLE ACCESS (BY INDEX ROWID) OF 'CENTRAL' (TABLE) (Cost=2 Card=1 Bytes=21)
    11 10 INDEX (UNIQUE SCAN) OF 'PK_CENTRAL' (INDEX (UNIQUE)) (Cost=1 Card=1)
    12 4 TABLE ACCESS (BY INDEX ROWID) OF 'CODTIT' (TABLE) (Cost=3 Card=1 Bytes=24)
    13 12 INDEX (RANGE SCAN) OF 'PK_CODTIT' (INDEX (UNIQUE)) (Cost=2 Card=1)
    14 3 TABLE ACCESS (BY INDEX ROWID) OF 'TITULOS' (TABLE) (Cost=1 Card=1 Bytes=175)
    15 14 INDEX (UNIQUE SCAN) OF 'PK_TITULOS' (INDEX (UNIQUE)) (Cost=0 Card=1)
    Statistics
    154 recursive calls
    0 db block gets
    32070 consistent gets
    1622 physical reads
    0 redo size
    305785 bytes sent via SQL*Net to client
    2807 bytes received via SQL*Net from client
    212 SQL*Net roundtrips to/from client
    10 sorts (memory)
    0 sorts (disk)
    3149 rows processed
    The query plan for the query WITHOUT Distinct and Order By is:
    Elapsed: 00:00:03.57
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=299 Card=47 Bytes=12220)
    1 0 NESTED LOOPS (Cost=299 Card=47 Bytes=12220)
    2 1 NESTED LOOPS (Cost=250 Card=49 Bytes=4165)
    3 2 NESTED LOOPS (Cost=103 Card=49 Bytes=2989)
    4 3 NESTED LOOPS (Cost=5 Card=49 Bytes=1960)
    5 4 TABLE ACCESS (BY INDEX ROWID) OF 'PALABRAS' (TABLE) (Cost=3 Card=1 Bytes=19)
    6 5 INDEX (RANGE SCAN) OF 'PALABRA' (INDEX (UNIQUE)) (Cost=2 Card=1)
    7 4 INDEX (RANGE SCAN) OF 'PK_OCURRENCIAS' (INDEX (UNIQUE)) (Cost=2 Card=140 Bytes=2940)
    8 3 TABLE ACCESS (BY INDEX ROWID) OF 'CENTRAL' (TABLE) (Cost=2 Card=1 Bytes=21)
    9 8 INDEX (UNIQUE SCAN) OF 'PK_CENTRAL' (INDEX (UNIQUE)) (Cost=1 Card=1)
    10 2 TABLE ACCESS (BY INDEX ROWID) OF 'CODTIT' (TABLE) (Cost=3 Card=1 Bytes=24)
    11 10 INDEX (RANGE SCAN) OF 'PK_CODTIT' (INDEX (UNIQUE)) (Cost=2 Card=1)
    12 1 TABLE ACCESS (BY INDEX ROWID) OF 'TITULOS' (TABLE) (Cost=1 Card=1 Bytes=175)
    13 12 INDEX (UNIQUE SCAN) OF 'PK_TITULOS' (INDEX (UNIQUE)) (Cost=0 Card=1)
    Statistics
    3376 recursive calls
    0 db block gets
    33443 consistent gets
    1061 physical reads
    0 redo size
    313751 bytes sent via SQL*Net to client
    2807 bytes received via SQL*Net from client
    422 SQL*Net roundtrips to/from client
    90 sorts (memory)
    0 sorts (disk)
    3149 rows processed
    I would appreciate a lot if somebody can tell me how to improve the performance of the query with Distinct and Order By.
    Thank you very much,
    Icaro Alzuru C.

    Hello,
    I am getting an slow answer when I add Distinct and Order By to the query:
    Without Distinct and Order By lasts 3.57 seconds; without Distinct and Order By lasts 28.15 seconds, which it's too much for our app.
    The query is:
    select distinct CC.acceso, CC.ext_acceso, TIT.TITULO_SALIDA
    from (((Ocurrencias CT01 inner join
    palabras p0 on (CT01.cod_palabra = p0.cod_palabra and p0.palabra like 'VENEZUELA%' AND p0.campo = 'AUTOR')) INNER JOIN
    CENTRAL CC ON (CT01.ACCESO = CC.ACCESO AND CT01.EXT_ACCESO = CC.EXT_ACCESO))) inner join
    codtit ctt on (CC.acceso = ctt.acceso and CC.ext_acceso = ctt.ext_acceso) inner join
    titulos tit on (ctt.cod_titulo = tit.cod_titulo and ctt.portada = '1')
    where CC.nivel_reg <> 's'
    ORDER BY 3 ASC;
    The query plan for the query WITH Distinct and Order By is:
    Elapsed: 00:00:28.15
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=301 Card=47 Bytes=12220)
    1 0 SORT (ORDER BY) (Cost=301 Card=47 Bytes=12220)
    2 1 SORT (UNIQUE) (Cost=300 Card=47 Bytes=12220)
    3 2 NESTED LOOPS (Cost=299 Card=47 Bytes=12220)
    4 3 NESTED LOOPS (Cost=250 Card=49 Bytes=4165)
    5 4 NESTED LOOPS (Cost=103 Card=49 Bytes=2989)
    6 5 NESTED LOOPS (Cost=5 Card=49 Bytes=1960)
    7 6 TABLE ACCESS (BY INDEX ROWID) OF 'PALABRAS' (TABLE) (Cost=3 Card=1 Bytes=19)
    8 7 INDEX (RANGE SCAN) OF 'PALABRA' (INDEX (UNIQUE)) (Cost=2 Card=1)
    9 6 INDEX (RANGE SCAN) OF 'PK_OCURRENCIAS' (INDEX (UNIQUE)) (Cost=2 Card=140 Bytes=2940)
    10 5 TABLE ACCESS (BY INDEX ROWID) OF 'CENTRAL' (TABLE) (Cost=2 Card=1 Bytes=21)
    11 10 INDEX (UNIQUE SCAN) OF 'PK_CENTRAL' (INDEX (UNIQUE)) (Cost=1 Card=1)
    12 4 TABLE ACCESS (BY INDEX ROWID) OF 'CODTIT' (TABLE) (Cost=3 Card=1 Bytes=24)
    13 12 INDEX (RANGE SCAN) OF 'PK_CODTIT' (INDEX (UNIQUE)) (Cost=2 Card=1)
    14 3 TABLE ACCESS (BY INDEX ROWID) OF 'TITULOS' (TABLE) (Cost=1 Card=1 Bytes=175)
    15 14 INDEX (UNIQUE SCAN) OF 'PK_TITULOS' (INDEX (UNIQUE)) (Cost=0 Card=1)
    Statistics
    154 recursive calls
    0 db block gets
    32070 consistent gets
    1622 physical reads
    0 redo size
    305785 bytes sent via SQL*Net to client
    2807 bytes received via SQL*Net from client
    212 SQL*Net roundtrips to/from client
    10 sorts (memory)
    0 sorts (disk)
    3149 rows processed
    The query plan for the query WITHOUT Distinct and Order By is:
    Elapsed: 00:00:03.57
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=299 Card=47 Bytes=12220)
    1 0 NESTED LOOPS (Cost=299 Card=47 Bytes=12220)
    2 1 NESTED LOOPS (Cost=250 Card=49 Bytes=4165)
    3 2 NESTED LOOPS (Cost=103 Card=49 Bytes=2989)
    4 3 NESTED LOOPS (Cost=5 Card=49 Bytes=1960)
    5 4 TABLE ACCESS (BY INDEX ROWID) OF 'PALABRAS' (TABLE) (Cost=3 Card=1 Bytes=19)
    6 5 INDEX (RANGE SCAN) OF 'PALABRA' (INDEX (UNIQUE)) (Cost=2 Card=1)
    7 4 INDEX (RANGE SCAN) OF 'PK_OCURRENCIAS' (INDEX (UNIQUE)) (Cost=2 Card=140 Bytes=2940)
    8 3 TABLE ACCESS (BY INDEX ROWID) OF 'CENTRAL' (TABLE) (Cost=2 Card=1 Bytes=21)
    9 8 INDEX (UNIQUE SCAN) OF 'PK_CENTRAL' (INDEX (UNIQUE)) (Cost=1 Card=1)
    10 2 TABLE ACCESS (BY INDEX ROWID) OF 'CODTIT' (TABLE) (Cost=3 Card=1 Bytes=24)
    11 10 INDEX (RANGE SCAN) OF 'PK_CODTIT' (INDEX (UNIQUE)) (Cost=2 Card=1)
    12 1 TABLE ACCESS (BY INDEX ROWID) OF 'TITULOS' (TABLE) (Cost=1 Card=1 Bytes=175)
    13 12 INDEX (UNIQUE SCAN) OF 'PK_TITULOS' (INDEX (UNIQUE)) (Cost=0 Card=1)
    Statistics
    3376 recursive calls
    0 db block gets
    33443 consistent gets
    1061 physical reads
    0 redo size
    313751 bytes sent via SQL*Net to client
    2807 bytes received via SQL*Net from client
    422 SQL*Net roundtrips to/from client
    90 sorts (memory)
    0 sorts (disk)
    3149 rows processed
    I would appreciate a lot if somebody can tell me how to improve the performance of the query with Distinct and Order By.
    Thank you very much,
    Icaro Alzuru C.

  • Out of Order Primary Keys and Blob fields

    Hi,
    I am using Oracle Migration Workbench to transfer the data from SQLServer 2000 to ORacle 9i. I am running into the following issues and was wondering if you had any ideas what may be going on:
    1.) Primary keys are out of order
    2.) Blob fields are inserted into the incorrect row
    Ex. BLOB field stating 'Application active' should be associated with Act_key (primary key) = 5 and it ends up transfering over with act_key 28.
    Thank you for any information you may have on this.
    AK

    I am very interested in this thread because I have encountered a similar problem with BLOB columns, except that I am also seeing this with CLOB's.
    Essentially the all the data gets 'migrated', but the CLOB and BLOB columns are all mixed up!
    Any solutions?

  • How we handle CLOB and BLOB Datatypes in HANA DB

    Dear HANA Gurus,
    We have would like to build EDW using HANA base on our source system Oracle and it's supports CLOB and BLOB datatypes
    Would you please suggest how do we handle in HANA DB.
    Let not say it's oracle specific.
    Regards,
    Manoj

    Hello,
    check SAP HANA SQL Reference Guide for list of data types:
    (page 14 - Classification of Data Types)
    https://service.sap.com/~sapidb/011000358700000604922011
    For this purpose might be useful following data types:
    Large Object (LOB) Types
    LOB (large objects) data types, CLOB, NCLOB and BLOB, are used to store a large amount of data such as text documents and images. The maximum size of an LOB is 2 GB.
    BLOB
    The BLOB data type is used to store large binary data.
    CLOB
    The CLOB data type is used to store large ASCII character data.
    NCLOB
    The NCLOB data type is used to store a large Unicode character object.
    Tomas

  • Using distinct and orderby in the select statment

    Hi All,
    Can anyone tell me what is the purpose of using distinct and orderby in the select statment.

    Hi,
    Using the distinct function with more than one column yields some substantial results. SQL will return the rows with distinct or unique combinations of those columns. Assume this same employee table has another column including the salary of each employee. With the use of the distinct function we can pull a list of unique job titles - salaries.
    SQL Code:
    SELECT DISTINCT job_titles, salary FROM employees;
    SQL has returned all the rows with unique combinations of job titles and salaries. Any duplicate combinations of job titles and salaries will be ignored. For example if we had two CEOs in the table making the same salary each year, only one row would be returned but if we had two CEOs with different salaries, both rows would be returned.
    Order by
    The SQL ORDER BY clause comes in handy when you want to sort your SQL result sets by some column(s). For example if you want to select all the persons from the already familiar Customers table and order the result by date of birth, you will use the following statement:
    SELECT * FROM Customers
    ORDER BY DOB
    As you can see the rows are sorted in ascending order by the DOB column, but what if you want to sort them in descending order? To do that you will have to add the DESC SQL keyword after your SQL ORDER BY clause:
    SELECT * FROM Customers
    ORDER BY DOB DESC
    If you don't specify how to order your rows, alphabetically or reverse, than the result set is ordered alphabetically, hence the following to SQL expressions produce the same result:
    SELECT * FROM Customers
    ORDER BY DOB
    SELECT * FROM Customers
    ORDER BY DOB ASC
    You can sort your result set by more than one column by specifying those columns in the SQL ORDER BY list. The following SQL expression will order by DOB and LastName:
    SELECT * FROM Customers
    ORDER BY DOB, LastName
    if its useful reward points

  • Select distinct and 2 inner joins in same select statement

    can anyone guide me how to write the below query for higher performance. can I use for all entires or shall i split this,
    please let me know your opinions.
    SELECT DISTINCT werks matnr b~stlal idnrk postp d~aennr
       sortf potx1 c~lkenz b~stlty stlst
       INTO TABLE ltab_one
       FROM mast AS a INNER JOIN stko AS b
         ON  a~stlnr = b~stlnr
         AND a~stlal = b~stlal
         INNER JOIN stas AS c
         ON  b~stlnr = c~stlnr
         AND b~stlal = c~stlal
         AND b~stlty = c~stlty
         INNER JOIN stpo AS d
         ON  c~stlnr = d~stlnr
         AND c~stlkn = d~stlkn
         AND c~stlty = d~stlty
      WHERE a~werks IN s_werks
         AND ( ( d~andat IN s_datum
            OR d~aedat IN s_datum
            OR a~andat IN s_datum
            OR a~aedat IN s_datum
            OR b~andat IN s_datum
            OR b~aedat IN s_datum
            OR c~andat IN s_datum
            OR c~aedat IN s_datum
            ) AND d~datuv >= lv_effdt )
         AND a~stlan = '1'
         AND matnr IN s_matnr.

      WHERE a~werks IN s_werks
         AND ( ( d~andat IN s_datum
            OR d~aedat IN s_datum
            OR a~andat IN s_datum
            OR a~aedat IN s_datum
            OR b~andat IN s_datum
            OR b~aedat IN s_datum
            OR c~andat IN s_datum
            OR c~aedat IN s_datum
            ) AND d~datuv >= lv_effdt )
         AND a~stlan = '1'
         AND matnr IN s_matnr.
    This part determines your performance, not the DISTINCT and not the joins.
    What is in s_werks, s-datum, s_matnr typically? I guess there are better and worse conditions.

  • Answers Select clauses:  DISTINCT and ORDER BY

    When I run an Answers query two things automatically happend:
    (1) The DISTINCT clause is added to the Select statement
    (2) An ORDER BY is aded to the end.
    The DISTINCT appears to be inclusive of all of the columns selected as are all of the columns included in the ORDER BY.
    Is there a way that I can setup ANSWERS so that it:
    (1) Does not default to add the DISTINCT?
    (2) Does not by default include an ORDER BY?
    (3) Limit the columsn that the DISTINCT is applied to?
    (4) Limit the number of columns in the ORDER BY to only those that I want to sort on?
    (5) Is there a way to specify in the OBIEE specific columns that should excluded from the DISTINCT and ORDERE BY?
    Thanks...

    I wrote a long explanation for this query and the oracle forum preview window decided to eat it, so I'm just posting the query, which might help some people looking for a SELECT DISTINCT approach that retains a sort order and takes the first value for the various grouping columns. In this case, my goal is to get a distinct list of agencies (agname):
    select distinct
          first_value(program_category_desc) over (partition by agname
            order by program_category_desc, program_subcategory_desc, progtypename, agname) cat,
          first_value(program_subcategory_desc) over (partition by agname
            order by program_category_desc, program_subcategory_desc, progtypename, agname) sub,
          first_value(progtypename) over (partition by agname
            order by program_category_desc, program_subcategory_desc, progtypename, agname) ptype,
          first_value(agname) over (partition by agname
            order by program_category_desc, program_subcategory_desc, progtypename, agname) ag
        from R_CONCERTS_REPORT
        order by first_value(program_category_desc) over (partition by agname
            order by program_category_desc, program_subcategory_desc, progtypename, agname),
          first_value(program_subcategory_desc) over (partition by agname
            order by program_category_desc, program_subcategory_desc, progtypename, agname),
          first_value(progtypename) over (partition by agname
            order by program_category_desc, program_subcategory_desc, progtypename, agname),
          first_value(agname) over (partition by agname
            order by program_category_desc, program_subcategory_desc, progtypename, agname);

  • Distinct and Unique

    hii,
    Is there any difference between distinct and unique in sql...

    user644122 wrote:
    hii,
    Is there any difference between distinct and unique in sql...Read the following blog post
    http://mhabib.wordpress.com/2007/03/09/what-is-difference-between-distinct-and-unique/
    And check this thread:
    Difference between UNIQUE  and DISTINCT

  • Dbms_crypto and blob datatypes

    Hi everyone
    I've been trying to learn how to encrypt data (a file uploaded) using blob datatype. This is me first attempt at encrypting and have been doing some research on this. I need to use the BLOB as I am encrypting a file that is uploaded to the system. Does anyone have experience in this or know of a good example that I can take a look at?
    Ray

    Hello,
    check SAP HANA SQL Reference Guide for list of data types:
    (page 14 - Classification of Data Types)
    https://service.sap.com/~sapidb/011000358700000604922011
    For this purpose might be useful following data types:
    Large Object (LOB) Types
    LOB (large objects) data types, CLOB, NCLOB and BLOB, are used to store a large amount of data such as text documents and images. The maximum size of an LOB is 2 GB.
    BLOB
    The BLOB data type is used to store large binary data.
    CLOB
    The CLOB data type is used to store large ASCII character data.
    NCLOB
    The NCLOB data type is used to store a large Unicode character object.
    Tomas

  • Java and BLOB

    Help...
    I need samples for storing files into BLOB by using Java code.
    Anyone knows?

    Here is my full code:
    /* This program is for testing Java and BLOB function */
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    public class BlobApplication {
    static Connection con=null;
    // static Statement stmt,stmt1,stmt2,stmt3=null;
    // static ResultSet rs,rs1,rs2,rs3=null;
    // static OracleConnection con=null;
    static OracleStatement stmt,stmt1,stmt2,stmt3=null;
    static OracleResultSet rs,rs1,rs2,rs3=null;
    static String sqlStr,sqlStr1,sqlStr2,sqlStr3="";
    static long blobLength;
         public static void main(String args[]) {
              try{     
                   Class.forName
    ("oracle.jdbc.driver.OracleDriver");
                   //con=(OracleConnection)
    DriverManager.getConnection
    ("jdbc:oracle:thin:@172.18.41.8:1521","EDB","edb");      
                   con=(OracleConnection)
    DriverManager.getConnection
    ("jdbc:oracle:oci8:@t18new","EDB","edb");      
                   //con=DriverManager.getConnection
    ("jdbc:oracle:oci8:@t18new","EDB","edb");      
                   BlobApplication lobApp=new
    BlobApplication();
                   lobApp.insertIntoLobTable("bfile1.dat");
                   //lobApp.insertIntoLobTable
    ("bfile2.dat");
                   //lobApp.insertIntoLobTable
    ("bfile3.dat");
                   lobApp.saveBlobTableToDisk();
                   con.close();     
              } catch (Exception e) {
                   e.printStackTrace();
         void insertIntoLobTable(String blobFilename){
              try {
         stmt=(OracleStatement)con.createStatement
         //stmt=con.createStatement();     
              stmt.execute("insert into lobtable
    (blobfilename,blobdata) values ('"+blobFilename+"', EMPTY_BLOB
              insertBLOB(blobFilename);
    stmt.close();
              catch (SQLException ex) {
                   System.err.println("Could not insert
    into the table lobtable \n"+ex);
                   System.exit(1);
         void insertBLOB(String filename) throws SQLException {
              try {
                   BLOB aBLOB=null;     
                   System.out.println(filename);     
                   File aFile=new File(filename);
                   FileInputStream aFileInputStream=new
    FileInputStream(aFile);               
         stmt1=(OracleStatement)con.createStatement();
         //stmt1=con.createStatement();     
              //sqlStr1="select * from lobtable where
    blobfilename='"+ filename +"' for update";
                   System.out.println("before query");
              rs1=(OracleResultSet)stmt1.executeQuery
    ("select * from lobtable where blobfilename='"+ filename +"' for
    update");               
              //rs1=stmt1.executeQuery(sqlStr1);          
              //stmt1.executeQuery(sqlStr1);
                   System.out.println("after query");
                   while (rs1.next()) {
                   System.out.println("in the loop");
              aBLOB=rs1.getBLOB(2);               
                             //int
    chunkSize=rs1.getBLOB("blobdata").getChunkSize();
                             int
    chunkSize=aBLOB.getChunkSize();
                             byte[] buffer=new byte
    [chunkSize];
                             int lenRead;
                             long offset=1;
                             while
    ((lenRead=aFileInputStream.read(buffer)) != -1) {
                                  if (blobLength<
    offset) buffer=new byte[lenRead];
                                  //rs1.getBLOB
    ("blobdata").putBytes(offset,buffer);
                                  aBLOB.putBytes
    (offset,buffer);
                                  offset+=lenRead;
              rs1.close();
    stmt1.close();                    
                        aFileInputStream.close();
              catch(IOException e) {
                   System.err.println("Error in
    reading "+filename+"\n"+e);
                   System.exit(1);
         void saveBlobTableToDisk() {
              try {
         stmt2=(OracleStatement)
    con.createStatement();     
         //stmt2=con.createStatement();     
              sqlStr2="SELECT blobfilename,blobdata
    FROM LOBTABLE";
              rs2=(OracleResultSet)stmt2.executeQuery
    (sqlStr2);
              //rs2=stmt2.executeQuery(sqlStr2);
                   while (rs2.next()) {     
                        writeBlobToDisk(rs2.getString
    ("blobfilename"), rs2.getBLOB("blobdata"));
              rs2.close();
    stmt2.close();                    
              catch (SQLException ex) {
                   System.err.println("Could not save to
    disk \n"+ex);
                   System.exit(1);
         void writeBlobToDisk(String filename,BLOB readBlob)
    throws SQLException {
              try {
                   File aFile=new File("blob_"+filename);
                   FileOutputStream aFileOutputStream=new
    FileOutputStream(aFile);
                   int chunkSize=readBlob.getChunkSize();
                   byte[] buffer=new byte[chunkSize];
                   blobLength=readBlob.length();
                   for (long pos=1; pos<blobLength;
    pos+=chunkSize) {
                        chunkSize=readBlob.getBytes
    (pos,chunkSize,buffer);
                        aFileOutputStream.write
    (buffer,0,chunkSize);
                   aFileOutputStream.close();
              catch (IOException e) {
                   System.err.println("Error in
    writing "+filename+"\n"+e);
                   System.exit(1);
    } // End of BLobApplication
    -----------------------------------------------------------------

  • AnyOf and BLOBs

    I have a 1 to many mapping
    person can have many addresses
    I want to find all persons with birthdays in 1976 with an address in california. I setup my expressions
    expression = builder.get("birthYear").equal(1976);
    state = builder.anyOf("addressList").get("state").equal("CA");
    expression = expression.and(state);
    readAllQuery ...
    Toplink first generates sql for select the person; then it generates sql for the addresses, but it uses a select distinct, which causes problems because my address has a BLOB.
    if i set don't use distinct then it seems to work, but then I get duplicate persons.
    this is 9.0.3. Any suggestions?
    thanks

    Hi,
    The workarounds for this issue are:
    1. turn off distinct. You already mentioned this and metioned the main drawback.
    2. Put the blob on another table and in another object. Reference that object in a 1:1mapping. This workaround requires you to change your object model and data model.
    3. Turn off the batching for addresses. (NOTE: The expression that you sent does not cause the problem. The problem is because you are reading the addresses in, not querying on them).

  • Replicating clobs and blobs in a remote database across dblink

    9iR2
    When creating a materialized view in a warehouse pointing to a remote table in an OLTP environment, I got this error when trying to replicate a table with 3 clobs.
    ORA-22992: cannot use LOB locators selected from remote tables
    So, how does Oracle recommend replicating Blobs and Clobs in a remote database/warehouse? Evidently using materialized views doesnt work.

    MV replication is obsolete.
    Move to 10gR2 and use Streams.

  • Associative Array and Blob

    I’m currently working on a system that allows the users to upload an Excel spreadsheet (.xls) in the system. The upload page is a PL/SQL cartridge. Then I’ve written a Java servlet (using Oracle Clean Content) to convert the XLS into a CSV and store it back in the database. (it is stored in the “uploaded_files” table as a blob). I’m trying to create another procedure to read the contents of the blob and display a preview of the data on the screen (using an html table (will be done using cartridge)). After the preview, the user can choose to submit the data into the database into the “detail_records” table or simply discard everything.
    I've been trying to use an associative array to grab all the data from the blob but I’m getting confused about how to implement it in my situation.
    Can someone provide any examples of this nature?
    Any help is greatly appreciated.

    I decided to create a "record" type with all the columns from my excel spreadsheet. Then I will create a table type of records
    I am doing something like this:
    declare
    type s_record is record
                            (l_name varchar2(100),
                             f_code varchar2(4) ,
                             l_code varchar2(6),
                             d_date varchar2(5),
                             d_type varchar2(5),
                             price number,
                             volume number,
                             tax number,
                             amount_paid number
    type s_data_tab is table of s_record index by binary_integer;
    v_s_data s_data_tab;
    v_indx binary_integer :=0;
    begin
    end; I am getting confused about parsing an entire row of values separated by commas into a row in the temporary table created above.
    I know I need a loop, but from what I understand, the way to populate data needs to be something like this, for example:
    for v_indx in 0..data_size loop
       v_s_data(v_indx).l_name:= 'Company A';
       v_s_data(v_indx).f_code := '2700';
    end loop; But I'm not sure how this approach should be used to parse an entire row at once.
    Any help appreciated.

  • Report 6i and Blob

    Currently, I have a word document (BLOB) stored in a table.
    The goal is to fetch the BLOB and display the content of the word doc in the report.
    I've tried to add a report field which maps to the db column as Binary LOB with File Format property = 'text'. (I've also tried File Format property = OLE and few others. none of them works)
    All I am getting is bunch of scrambled character.
    What am I missing here?
    Thanks!

    I looked around Metalink and found...
    Unable to Display Complete MS-Word Document from Oracle Reports [ID 233445.1].
    It mentioned one work around is to transform the ms-doc to a text file.
    However, I am more interesting in what you mentioned earlier... "Split the original in several one page doc."
    Is there a programming way to achieve the goal for splitting the original doc in several pages while save into DB via Oracle Form? or do we just have to split the doc manually?
    Thanks.

  • SSRS reporting with sharepoint list using Distinct and Multivalue parameters

    i want create ssrs report with sharepoint list using ms-vs(2008). i want create Distinct multivalue parameters by using CAML query. There is any way we put CAML query where we use Distinct keyword and IN clause in CAML query... i hope all experts will
    understand my poor English... sorry for poor English.. plz help me

    Hi AsifMehmood,
    Per my understanding you have create an SSRS report with SharePoint list, now you don’t know to create the distinct parameters by using CAML query,  right?
    For the CAML language doesn’t have any reserved word (or tag) to set this particular filter to remove duplicate results, but we can use the custom code to do this function. I have tested on my local environment and we can do that by create one hidden parameter(Param1)
    to get all the values from the fields which will  add the filter and then create another parameter(Param2) to get the distinct values based on the Param1, we use the custom code to do the deduplication.
    Step by Steps information in below thread for your reference to create the parameters and the custom code:
    "How to get distinct values of sharepoint column using SSRS"
    Other similar thread for your reference:
    https://audministrator.wordpress.com/2014/02/17/sharepoint-list-add-distinct-parameter-value/
    If your problem still exists, please feel free to ask and also try to provide us more details information.
    Regards
    Vicky Liu

Maybe you are looking for

  • Open Qty and Delivered Qty  remains same even after Return

    Hello After making return, the open qty remains the same and its not reflecting the return qty. for e.g. I have made a Sale Order of 100 qty I delivered 20 In sales order my Delivered Qty is 20 and Open qty is 80 Now I made a Return of above 20 Qty B

  • Report Column Conditional Display

    Hi, After reading a load of other posts, it seems like there is no way to have a column display conditionaly based on the other column values. What I am trying to acheive is when an "Already Authorised" column is set to N, a link column displays with

  • Re: array of references to linked lists

    Hi, im having a little problem seeing the wood from the tree...shouldnt be too hard for a fresh pair of eyes...ive been trying for a while now(read ages !!). I have an array which will be populated with seperate linked lists (StudentList class) which

  • In BP master, payment terms

    Hi Experts, In BP master, payment terms have credit limit and commitment limit, I want to know how it works. Anyone guide me. Thanks and regards, Manikandan

  • Error: The document "filename.pages" couldn't be opened.

    I got a new Mac Mini and put 2009 iWork on it and immediately ran the update. I can't open any documents!! All I get is "The document "filename.pages" couldn't be opened." What is going on? I have a legitimate iWork disc and DO not want to have to bu