Dynamic sizing of RAW datatype

Hi All,
I want to read BLOBs out of a table using the DBMS_LOB package
I would like to do something like...
my_blob_length := DBMS_LOB.GETLENGTH(my_blob);
DECLARE
my_buffer RAW(my_blob_length); -- this is the bit I'm stuck with ;-)
DBMS_LOB.READ(my_blob, my_blob_length, 0, my_buffer);
But I don't know how to dynamically size the RAW buffer. Any advice gratefully received.
Cheers,
Ewan

But I don't know how to dynamically size the RAW buffer. Any advice gratefully received.The only way (I can think of) that you can dynamically declare length, precision, or scale for a PL/SQL variable is to do within an anonymous PL/SQL block of Native Dynamic SQL.
Doing this is probably more of a headache than it is worth - very impractical to code/debug/maintain/scale.
Michael

Similar Messages

  • How can i read a stored picture in oracle Long Raw datatype? blob or clob?

    How can i read a stored picture in oracle Long Raw datatype? Like a blob or clob?....i am using jdk 1.3
    This is because...i tried to read it like a blob but i obtain a exception...about Type of column no valid......but the column exist....and it contains the long raw datatype of the pictures.....this is my code:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.BLOB;
    import oracle.sql.BLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    class rec_ima1
    public static void main(String h[])
    Connection con = null;
    Blob bl;
    final ImageIcon image1;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    if (!rs.next())
    System.out.println("Empty Result Set");
    bl = rs.getBlob(5);
    if (bl == null) {
    System.out.println("Null Blob");
    return;
    InputStream is = bl.getBinaryStream();
    int imageLength = (int) bl.length();
    System.out.println(imageLength);
    System.out.println(bl.length());
    byte[] imageData = new byte [imageLength];
    is.read(imageData, 0, imageLength);
    image1 = new ImageIcon(imageData);
    photo = new JPanel() {
    public void paint(Graphics g){
    g.setColor(Color.lightGray);
    g.drawImage(image1.getImage(), 0, 0, this);
    } catch (Exception e) {
    e.printStackTrace();
    Now i tried using clob:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.CLOB;
    import oracle.sql.CLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.CallableStatement;
    class rec_ima4
    public static void main(String h[])
    Connection con = null;
    Clob cl;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    con.setAutoCommit (false);
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    while (rs.next()) {
    oracle.sql.CLOB clob = (CLOB) rs.getObject(5); //line 47
    } catch (Exception e) {
    e.printStackTrace();
    This is the runtime exception:
    java.lang.ClassCastException: [B
    at rec_ima4.main(rec_ima4.java:47)

    Thanks by answering to me......
    Well....i did that....but what is ImageIO?....
    I declared a ImageIcon imageIO, but this give me the following:
    rec_ima3.java:49: cannot resolve symbol
    symbol : class BufferedImage
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    rec_ima3.java:49: cannot resolve symbol
    symbol : variable ImageIO
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    What classes i have to import?.....what is ImageIO?
    Thanks

  • How to convert number datatype to raw datatype for use in data warehouse?

    I am picking up the work of another grad student who assembled the initial data for a data warehouse, mapped out a dimensional dw and then created then initial fact and dimension tables. I am using oracle enterprise 11gR2. The student was new to oracle and used datatypes of NUMBER (without a length - defaulting to number(38) for dimension keys. The dw has 1 fact table and about 20 dimension tables at this point.
    Before refining the dw further, I have to translate all these dimension tables and convert all columns of Number and Number(n) (where n=1-38) to raw datatype with a length. The goal is to compact the size of the dw database significantly. With only a few exceptions every number column is a dimension key or attribute.
    The entire dw db is now sitting in a datapump dmp file. this has to be imported to the db instance and then somehow converted so all occurrences of a number datatype into raw datatypes. BTW, there are other datatypes present such as varchar2 and date.
    I discovered that datapump cannot convert number to raw in an import or export, so the instance tables once loaded using impdp will be the starting point.
    I found there is a utl_raw package delivered with oracle to facilitate using the raw datatype. This has a numbertoraw function. Never used it and am unsure how to incorporate this in the table conversions. I also hope to use OWB capabilities at some point but I have never used it and only know that it has a lot of analytical capabilities. As a preliminary step I have done partial imports and determined the max length of every number column so I can alter the present schema number columns tp be an apporpriate max length for each column in each table.
    Right now I am not sure what the next step is. Any suggestions for the data conversion steps would be appreciated.

    Hi there,
    The post about "Convert Numbers" might help in your case. You might also interested in "Anydata cast" or transformations.
    Thanks,

  • How to view contents in Long Raw datatype column

    Hi,
    We have two node RAC database with 10.2.0.4.0 version.
    OS - IBM AIX.
    We have a table with a column with datatype "LONG RAW" in production. It stores image files.
    We need to send the images from few rows to third party vendor. Basically, they need to view the images.
    Earlier, I have exported to dump file using datapump and sent to vendor. but vendor is telling that they are not able to view the images. Can you please suggest best method to transfer the images (LONG RAW datatype) and the method to view them.

    We have a table with a column with datatype "LONG RAW" in production. It stores image files.
    We need to send the images from few rows to third party vendor. Basically, they need to view the images.
    Earlier, I have exported to dump file using datapump and sent to vendor. but vendor is telling that they are not able to view the images. Can you please suggest best method to transfer the images (LONG RAW datatype) and the method to view them.How is the vendor trying to use the extracted images? Data exported with datapump must be imported into another database with datapump. The same applies to the exp utility (must use imp to load into a database).
    If you're careful you should be able to write a binary file using utl_file.
    Regarding the long raw, is there any way you could convert to BLOBS? Longs and Long raws are notoriously hard to work with

  • The question about RAW datatype in VBA with OO4O

    Hi all.
    I have developed a sort of VBA program with oo4o.
    When I issued "select rawtohex(saddr),saddr from v$session where rownum < 2" and I displayed the result on excel spread sheet.
    The result was below.
    RAWTOHEX(SADDR)      SADDR
    C0000000E14ADDF0     &#65533;
    I found I couldn't display a raw datatype result without using RAWTOHEX function.
    But, I query the table using "*",such as " select * from v$session" sometime. So I have to display the raw datatype result without using oracle function.
    I heard that the "RAW" datatype is a array of byte, so I used byte array.
    The following is my first idea and the result is wrong.
    The result is 'FF000000......', not 'C000000....'
    Is there any good idea?
    Dim oSession As Object
    Dim oDatabase As Object
    Dim oRs As Object
    Dim cntCol, cntRow As Long
    Dim rowNum, colNum As Long
    Dim sraw() As Byte
    Dim k As Integer
    Dim hexaString As String
    Set oSession = CreateObject("OracleInProcServer.XOraSession")
    Set oDatabase = oSession.DbOpenDatabase(gTargetServer, gUserID & "/" & gPasswd, 0&)
    Set oRs = oDatabase.DbCreateDynaset(gSqlString, 0&)
    cntCol = oRs.Fields.Count
    cntRow = oRs.RecordCount
    ReDim resData(cntRow, cntCol) ' the variant type array to store result
    'To store column title.
    For colNum = 0 To cntCol - 1
    resData(0, colNum) = oRs.Fields(colNum).Name
    Next colNum
    'To store data.
    For rowNum = 1 To cntRow
    For colNum = 0 To cntCol - 1
    Select Case oRs.Fields(colNum).Type
    Case 11
    sraw = oRs.Fields(colNum).Value
    For k = 0 To UBound(sraw)
    hexaString = hexaString & Hex(sraw(k)) '<= here.***********
    Next k
    resData(rowNum, colNum) = hexaString
    Case Else
    resData(rowNum, colNum) = oRs.Fields(colNum).Value
    End Select
    Next colNum
    oRs.MoveNext
    Next rowNum
    I hope I get helps.
    Bill.

    But, I query the table using "*",such as " select * from v$session" sometimeCan't you use
    select rawtohex(saddr) hexaddr, t.* from v$session t
    (if you really need '*' ) ?
    Rgds.

  • ABEND in Java User Exit with RAW DataType

    I have a Java User Exit Extract running against a trail file that has been pumped to the GoldenGate instance in question.  The extract starts up without any issues, but gives the following error after I update a record that has a RAW datatype as the primary key:
    JAVAWRITER(javawriter.c:269) [ERROR]: Error occurred (Java exception): UEDataSource.createOperation:
    com.goldengate.atg.datasource.InvalidTransactionState: A new operation was received without first receiving a BEGIN transaction. This can happen when processing is resumed in the middle of a transaction, or when there are "before" images in the trail that are not being sent to the user exit (always include "GetUpdateBefores" in the user-exit parameter file).
    I have tried a number of things to try to resolve this, but I can't seem to make this work.  the params for this extract currently looks like this:
    extract uePump
    sourcedefs ./dirdef/my_defgen.def
    setenv (GGS_USEREXIT_CONF = "dirprm/javaue.properties")
    getupdatebefores
    cuserexit ./dirprm/libggjava_ue.so CUSEREXIT passthru includeupdatebefores
    table my_schema.B_PLN_DIR, fetchmodcols (PLN_DIR_ID, *);
    table my_schema.*;
    ... I've tried leaving off the "includeupdatebefores" argument to the cuserexit, leaving out the fetchmodcols handling for the table with the RAW PK field, but I still get the error shown above.
    Any help / pointers is much appreciated.

    includeupdatebefores (lowercase) doesn't work;  you must use the uppercase INCLUDEUPDATEBEFORES !!

  • Export and Import Of Tables having BLOB and Raw datatype

    Hi Gurus,
    I had to export one schema in one database and import to another schema in another database.
    However my current database contains raw and blob datatype.I have exported the whole database by the following commnad
    exp SYSTEM/manager FULL=y FILE=jbrms_full_19APR2013.dmp log=jbrms_full_19APR2013.log GRANTS=y ROWS=y
    My question is if all the tables with raw and blob have been exported properly or not.I have done one more thing after taking the export , I have imported to local db and checked the no of rows in the both the envs are same.As I have not tested with the application to confirm.
    I am using this version of Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    not able to attach the complete log file but for the schema jbrms which has the blob and raw datatype.
    Please let me know if you find some potential concerns with the export for BLOB and raw
    . about to export JBRMS's tables via Conventional Path ...
    . . exporting table FS_FSENTRY 8 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table FS_WS_DEFAULT_FSENTRY 2 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table PM_WS_DEFAULT_BINVAL 60 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table PM_WS_DEFAULT_BUNDLE 751 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table PM_WS_DEFAULT_NAMES 2 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table PM_WS_DEFAULT_REFS 4 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table VERSIONING_FS_FSENTRY 1 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table VERSIONING_PM_BINVAL 300 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table VERSIONING_PM_BUNDLE 11654 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table VERSIONING_PM_NAMES 2 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    . . exporting table VERSIONING_PM_REFS 1370 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.

    You could see the 'QUESTIONABLE STATISTICS' warning for a couple of reasons. I don't remember them all but.
    1. If the target and source character set is different.
    2. system generated names (I think?)
    the best solution if you don't need the exact statistics that are on your source database would be to add
    statistics=none
    to your imp command and then regather statistics when the imp command is done.
    Dean

  • Migration of LONG and LONG RAW datatype

    Just upgraded a DB from 8.1.7.4 to 10.2.0.1.0. In the post-upgrade tasks, it speaks of migrating tables with LONG and LONG RAW datatypes to CLOB's or BLOB's. All of my tables in the DB with LONG or LONG RAW datatypes are in the sys, sysman, mdsys or system schemas (as per query of dba_tab_columns). Are these to be converted? Or, does Oracle want us to convert user data only (user_tab_columns)?

    USER_TAB_COLUMNS tells you the columns in the tables owned by the current user. There may well be many users on your system that you created that contain objects. I suppose you could log in to each of those schemas and query their USER_TAB_COLUMNS table, but it's probably easier to query DBA_TAB_COLUMNS with an appropriate WHERE clause on the owner of the objects.
    Justin

  • Dynamic sizing

    I'm working on a spinner control, similar to JSpinner under Swing. It should look like this: < value >
    Two arrows and a value in between.
    The whole control thing I've got setup ok, I'm having trouble with the painting. The spinner is constructed of three nodes: Arrow, Label, Arrow held together in a GridPane.
              // the layout
              GridPane lGridPane = new GridPane();
              // left arrow
              Arrow lLeftArrow = new Arrow(true);
              lGridPane.add(lLeftArrow, 0, 0);
              // for showing the value
              Label lValueLabel = new Label("test");
              lGridPane.add(lValueLabel, 1, 0);
              // right arrow
              Arrow lRightArrow = new Arrow(true);
              lGridPane.add(lRightArrow, 2, 0);
              // add to self
              getChildren().add(lGridPane); // TODO: use GridPane but get the CSS layout to work
         }The Arrow naturally is a single class with a rotation and transform to get the left pointing or right pointing version. Something like this:
         class Arrow extends Region
              public Arrow(boolean left)
                        Line line = new Line();
                        line.setStartX(0.0f);
                        line.setStartY(0.0f);
                        line.setEndX(10.0f);
                        line.setEndY(10.0f);
                        getChildren().add(line);
                        Line line = new Line();
                        line.setStartX(10.0f);
                        line.setStartY(10.0f);
                        line.setEndX(0.0f);
                        line.setEndY(20.0f);
                        getChildren().add(line);
                   // optionally rotate 180
                   if (left)
                        this.getTransforms().add(new Translate(10, 20));
                        this.getTransforms().add(Transform.rotate(180, 0, 0));
         }My question is: the styling of the label is done in CSS, so I do not know how large the font will be. How do I bind the height and width of the Arrow to the size of the outside container?
    The GridLayout makes the Arrow now the same height as the label, so I've tried different bindings, like
    Bindings.add(line.endYProperty(), this.heightProperty().multiply(0.5));But with no succes.

    But I don't know how to dynamically size the RAW buffer. Any advice gratefully received.The only way (I can think of) that you can dynamically declare length, precision, or scale for a PL/SQL variable is to do within an anonymous PL/SQL block of Native Dynamic SQL.
    Doing this is probably more of a headache than it is worth - very impractical to code/debug/maintain/scale.
    Michael

  • How can i see the containts of Raw datatype

    hi friends,
    I have an application in which some raw datatype is given i wanted to see through sql or plsql ,is any conversion function is there in oracle to see it,if no then how to see it .
    raj

    Try SQL Function RAWTOHEX()
    Fine more info on
    http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a85397/function.htm#78519

  • How to find the long/raw datatype tables

    HI ppl,
    I want to find out the long/raw datatype tables in Oracle database.
    Please provide the query..
    Plz help.
    Oracle version :10gr2
    platform:HP-UNIX

    Hi,
    is this is what you are looking for?
    SELECT
         TABLE_NAME,
          COLUMN_NAME,
          OWNER
    FROM
          DBA_TAB_COLUMNS
    WHERE
          DATA_TYPE IN('LONG','RAW')Regards

  • Dynamic sizing of a component to fit the content

    Hi All,
    How can I make my component so that it will be dynamically sized to fit the content height?  I would like to create a component that will have a variable height.  It has a serious of user input controls.  Depending on the answers given, more input from the user may be necessary--specifically, they will have to provide an explanation in a textbox.
    So, my thinking is that I don't want to display the textbox unless they answer "yes" to any questions that require additional explanation.  If they do, then I want display the TextArea control along with instructions to enter an additional explanation here.
    However, when I do that, it will cause my component's height to grow.  I don't want to reserve space for that textbox in the component's dimensions--I would prefer it simply grow (pushing anything below it further down) if and when the textbox appears.
    How would I go about doing this?
      -Josh

    I think the standard JSF solution would be not to do the create/delete of inputs on the client side, but to do it on the server side.
    If that is not your cup of tea, I think that the standard components will not be sufficient. So you are looking at either not binding the inputs to a component and just getting the values via the request parameters or creating a custom component capable of dealing with this.

  • Creating dynamic sized arrays and filling them automatically on speedy 33

    hi all,
    I am trying to create dynamic sized arrays on Speedy-33. Specifically, depending on the user input, I want to be able to create
    arrays with 128 or 256 elements and fill them automatically. However,
    array constant element is fixed for Speedy 33; thus I have to manually set the
    size of the array with the mouse and enter the values in to the array by
    myself. I want to make this tedious process automatic. Would this be possible? thanks so much for comments!
    ~casiopea

    Casiopea,
    There is a really great article on using arrays with LabVIEW DSC which can be found here:
    How Can I Be Successful With Arrays In the LabVIEW DSP Module?
    One of the biggest things that should be noted about DSP is that there is no dynamic memory allocation.  Your array size must be fixed, and thus, your array needs to be initialized by using a constant. 
    An easy way to initialize an array constant that has many elements that are all the same is to simply create a numeric constant that has the value that you want.  Then, create a new blank array constant and drag the numeric into it.  In the index input for the array constant, type in the index of the last element that you want to be initialized.  Then type in the value in the element that is displayed and all of the elements before it will be initialized to the default value of the numeric constant that you dropped into the array constant.  I hope this helps.  I would really recommend reading through that article, as it has a lot of great information about using arrays with DSC.
    Brian Coalson
    Software Engineer
    National Instruments

  • How to dynamically convert the return  datatype of a procedure

    Hi ,
    I want to write a procedure which will take two argument.
    one will be string and another one will be a out variable having dynamic return type based on the data in first passing parameter.
    Description:
    let suppose i have one table which has 3 column
    1.String_col1 varchar2 (it will contain String combination of alphabets,numbers)
    2.number_col2 varchar2 (it will contain numbers only)
    3.date_col3 varchar2 (it will contain DATE)
    All columns are having varchar2 as their datatype.(in sort all are String).
    now i want to write a procedure which will convert the datatype of all the three columns into their respective datatypes i.e.
    1.String_col1 varchar2
    2.number_col2 number
    3.date_col3 date
    Note:I am passing only 1 column in procedure as IN parameter.I dont want to convert 1 row in their respective datatype.
    Please let me know if you want any more information from my side.

    I'm pretty sure that isn't possible.
    What you could do is write a function to determine the datatype of the input, and use the return value of that function in either a decode or case statement to determine which of 3 explicitly defined functions to use.
    Carl

  • Dynamic declaration of XSD datatype in Java

    Hi,
    I am writing a dynamic client for invoking web service solely based on the information from their wsdl documents. Suppose the service uses some customized datatype defined with XSD. Assume I have those datatypes in Java class already. Now I can parse the wsdl document to get the name of a specific datatype of an input part. But how can I declare an object of that datatype in Java with the name of that datatypestored in a variable? One possible solution is to compare it against all possible datatype names, like
    if (name.equals("string") {
    String myObject = new String();
    }else if (name.equals("integer") {
    Integer myInteger = new Integer();
    But obviously this isn't a practical solution since thedatatypes are so many, not even mention user defined ones.
    Can anyone giveme some suggestion? Thanks a lot.
    Yu

    Class.forName(String name)
    The Java Tutorial� - Trail: The Reflection API

Maybe you are looking for

  • IOS said I have a virus on my iPad mini how do I get rid of it

    iiOS said I have a virus how do I get rid of this virus ? And what app do I need ?

  • BUG: Multiple file renaming

    I believe I have found a bug in the file renaming routine in LR: I store related .jpg and .nef (raw) files in the same folder. Each .nef has a corresponding .jpg version with the same file name. I wanted to rename all the files in one folder by selec

  • Photo disc will not open. I get "blank disc" message

    I have MacBook Pro OS X 10.8.2.  I get a message that the photo disc that I insert is blank.  It opens okay with my MacBook air with an external reader. It also worked on the Snow Leopard and Lion versions.  Is there a setting that I've missed?

  • Help EQG-30019 error message

    hi! Yesterday I configured the search crawler. I think I changed the default character set,default language and turn on clear cache after indexing. Today I create a table source,but can't search anything from this source. I look at the log file, get

  • Upgrade to 11.2.3

    Hi expert , i have oracle 11.2.2 ASM RAC under OL 5.6 before 2 days i face a bug that the alert log and trace file was groth abnormally and the file system that store that alert and trace is full and there is no one can access the database from this