How to convert  from  varchar to blob ?

How to convert from varchar to blob ?
thanks

Here is a small PL/SQL block that we have used to convert varchar2 to blob.
declare
cursor get_blob is
select blob_statement
from report
where report_id = 205
FOR UPDATE OF blob_statement;
v_loc blob;
v_raw_buffer raw(32767);
v_amount binary_integer := 32767;
v_offset binary_integer := 1;
v_buffer VARCHAR2(32767);
begin
open get_blob;
fetch get_blob into v_loc;
close get_blob;
v_buffer := 'Sample text';
v_raw_buffer := utl_raw.cast_to_raw(v_buffer);
v_amount := utl_raw.length(v_raw_buffer);
dbms_lob.write(v_loc, v_amount, v_offset, v_raw_buffer);
commit;
end;

Similar Messages

  • Re: How to converting from PL/SQL query to T-SQL query

    How to converting from PL/SQL query to T-SQL query... Its Urgent

    Download the
    SQL Server Migration Assistant for Oracle.  It will convert whole Oracle databases, or single queries or PL/SQL stored procedures.
    With caution that If your database is using Collation which is case sensitive SSMA will not work.SSMA doesnt guarantees 100% for conversion of Queries/stored proc /database if it fails to do so for some queries you will have to do it manually.
    But you can try
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How to convert a CLOB to BLOB

    Hi,
    Can any one tell me how to convert a CLOB into BLOB? In Oracle 10g there is a function which is converttoblob(). But in Oracle 9i there is no function as such. If i am using Hextoraw() function still then its giving some pointer error. please let me know the solution.

    FUNCTION c2b( c IN CLOB ) RETURN BLOB
    -- typecasts CLOB to BLOB (binary conversion)
    IS
    pos PLS_INTEGER := 1;
    buffer RAW( 32767 );
    res BLOB;
    lob_len PLS_INTEGER := DBMS_LOB.getLength( c );
    BEGIN
    DBMS_LOB.createTemporary( res, TRUE );
    DBMS_LOB.OPEN( res, DBMS_LOB.LOB_ReadWrite );
    LOOP
    buffer := UTL_RAW.cast_to_raw( DBMS_LOB.SUBSTR( c, 16000, pos ) );
    IF UTL_RAW.LENGTH( buffer ) > 0 THEN
    DBMS_LOB.writeAppend( res, UTL_RAW.LENGTH( buffer ), buffer );
    END IF;
    pos := pos + 16000;
    EXIT WHEN pos > lob_len;
    END LOOP;
    RETURN res; -- res is OPEN here
    END c2b;

  • Hi iam new to java can u tell me  how to convert from hashmap to string

    how to convert from hashmap to string

    Hi,
    This is not pure Java forum. Its more on JDBC and data connectivity to Orcle db from Java API.
    This link may answer your question:
    http://stackoverflow.com/questions/960807/hashmapkey-string-value-arraylist-returns-an-object-instead-of-arraylist
    Twinkle

  • How to convert from Restricted material to Unrested Material

    Hi Every Body,
         I have Posted the Batch Material in MB1C . But it was posted in RESTRICTED IN USE. How to convert from Restrict To UNRESTRICTED IN USE. Can Anybody Help me.

    Thank you for solving the problem both SAP Community Network and Mr Jurgen .
    suribabu

  • How to convert from image based pdf to text based pdf

    I have Adobe 9 Pro. How to convert from image based pdf to text based pdf? For example, if someone emails a scanned pdf to me, how do I convert that document into a text based pdf?

    To perform OCR, open the document and select: Document > OCR Text Recognition > Recognize Text Using OCR
    More information on the various options is in the Acrobat help doc.

  • How to convert from java.lang.Integer to int

    Could you please show me
    how to convert from java.lang.Integer to int?
    and how to convert from java.lang.Integer to String?
    Thanks,
    Minh

    Could you please show me
    how to convert from java.lang.Integer to int?
    and how to convert from java.lang.Integer to String?Tip: always keep a browser open on the API docs; if you've got a
    couple of MBs to spare, download the docs; it's very convenient.
    kind regards,
    Jos

  • How to convert from array to graph ?

    how to convert from array to graph ?

    A graph will accept an array of numbers.  Do you have an example of what you are looking for?
    And since somebody mentioned tutorials...
    3 Hour Introduction
    6 Hour Introduction
    LabVEW Basics
    Self Paced training for students
    Self Paced training beginner to advanced, SSP Required
    LabVIEW Wiki on Training
    Learning NI
    Getting Started with NI Products
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to convert from pdf to word

    how to convert from pdf to word

    If you are using Adobe Acrobat please post here: http://forums.adobe.com/community/acrobat/creating__editing_%26_exporting_pdfs
    If you are using Adobe Reader and ExportPDF, please read this: http://forums.adobe.com/docs/DOC-1812

  • How to convert from XML to Array ?

    how to convert from XML to Array ?
    thanks in advance

    this is a segment of the xml object:
    var myXML:XML =
    <data>
    <task>
    <taskID>2</taskID>
    <startDate>2/15/2007</startDate>
    </task>
    </data>
    i want to conver myXML into ArrayCollection: like this:
    private var expenses:Array = [
    {taskID:"1", startDate:"2/15/2007"},
    {taskID:"2", startDate:"4/15/2007"}
    how i can do it ? and tell me how to retrieve the data from
    the collection
    thanks

  • How to convert from military time (string) to regular time?

    How to convert from military time (string) to regular time?
    First of all I need to let you know I'm very new to Crystal Reports, so I apologize and will need detailed instructions if possible.
    I have created a Crystal Report pulling information from the received time field.  On the report, the time is showing in military time (ex. 16:00:00).
    How can I convert this time to normal time (ex. 4:00:00)
    Since the field is a 'String' field and not a 'Time' field, I do not have the option of changing it under the field properties.
    I hope someone can help with this.
    Thank you in advance.

    As my fields were date only and not datetime, I ended up using the following,
    If IsDate({CallLog.EmailRecdDate}) Then
         CDate({CallLog.EmailRecdDate})
    Else
         CDate(0,0,0)
    You answer lead me in the right direction.
    I'm still having an issue with the 'Else' statment returning 12:00:00 because of the CDate(0,0,0), but I'm not sure what else I can use to return a blank space on the report.  Any ideas?
    Thanks again!

  • How to convert from lowercase letters to uppercase letters?

    how to convert from lowercase letters to uppercase letters?

    Hi KS,
    In the transfer / update rules you can use a formula to convert lowercase to upper case letters.
    Functions for Character string>>TOUPPER(CHAR)
    Hope this helps.
    Bhargava
    Message was edited by:
            Sista Bhargava Kumar

  • How to convert from xml file to html using java code

    How to convert from xml file to html file using java code

    Get yourself Apache Xalan or Saxon or some XSLT processor
    String styleSheet = "/YourXSLTStylesheet.xsl";
    String dataSource = "/YourXMLDocument.xml";
    InputStream stylesheetSource = TransformMe.class.getResourceAsStream(styleSheet);
    InputStream dataSourceStream = TransformMe.class.getResourceAsStream(dataSource);
    OutputStream transformedOut = new FileOutputStream("filename.html");
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer(new StreamSource(stylesheetSource));
    transformer.transform(new StreamSource(dataSourceStream), new StreamResult(transformedOut));You'll also need to learn XSLT if you don't already know that. Here's a good place to start
    http://www.w3schools.com/xsl/

  • How to convert from Grayscale to single color channel

    I hope that someone here might be able to help. I am writing an application which loads in color channels separately, to be merged by the application The images are multi-page TIFF files. The trouble that I am running into is that the application loads the images into grayscale, so when I merge the channels, they are merged as grayscale, not as the correct colors.
    I use the following on each color channel to load them in:
    public static BufferedImage[] loadTiff(File multiPageFile, int colour) {
        BufferedImage[] img = null;
        ArrayList<BufferedImage> tmp = new ArrayList<BufferedImage>();
        try {
            SeekableStream stream = new FileSeekableStream(multiPageFile);
            String[] names = ImageCodec.getDecoderNames(stream);
            ImageDecoder dec = ImageCodec.createImageDecoder(names[0], stream, null);
            int numPages = dec.getNumPages();
            for (int i=0; i<numPages; i++) {
             try {
                    RenderedImage im = dec.decodeAsRenderedImage(i);
                    BufferedImage bi = PlanarImage.wrapRenderedImage(im).getAsBufferedImage();
              //In case not all pages are valid images, we use ArrayList as it is dynamic
              tmp.add(bi);
                }catch (RuntimeException re) {
              //Once the exception is caught, we can decode the layer here for whatever means.   
        }catch (FileNotFoundException fnfe) {
            System.err.println("File not found.");
            fnfe.printStackTrace();
        }catch (Exception e) {
            System.err.println("General Exception caught");
            e.printStackTrace();
        //Convert to an array to be returned.
        img = new BufferedImage[tmp.size()];
        for (int i=0; i<img.length; i++) {
            img[i] = tmp.get(i);
        return img;
    }So a BufferedImage array is returned (one element in the array for each page in the multi-page file). Before I return the BufferedImage array, though, it would be good to convert it to the correct color. I know which channel is currently being loaded. Does anyone have any tips on how to shift from a grayscale intensity to a single color intensity? I have tried a number of things regarding byte shifting, but I am really none the wiser.
    I have tried, for example, reading the int color value:
    int color = bi.getRGB(w,h);The trouble is that this number is not in the region 0..255, so I don't know how I can use it. If I shift the number:
    color = color>>16I get a number smaller than 255 (although it seems to be negative), but I don't know whether I can use this value for a single color channel, i.e. if the current color is red, saying:
    Color redC = new Color(color, 0, 0);
    bi.setRGB(w,h,redC); //Slow and inefficient. There must be a better way.When I try doing that, I end up with nothing drawn or visible.
    Does anyone have any ideas? Thanks in advance.
    Edited by: doughnuts64 on Jun 12, 2008 6:27 AM

    Thanks for the response. It has been helpful in getting my problem sorted. I was not creating a new BufferedImage - I was just using the one that had been loaded in, and as such had not realised that the type was not TYPE_INT_RGB. As soon as I instantiated a new BufferedImage of the same dimensions and colour TYPE_INT_RGB as you suggested, it worked! So thanks for that.
    Whilst that does work, it does slow the application incredibly as it has so much data to cycle through. Ideally, I would be able to load the image in directly as the colour channel in question, rather than loading in as grayscale. This way, the application would only require the amount of time needed to load in the images, not to process them on a pixel-by-pixel basis (typical images are made up of over 16,000,000 pixels for each colour channel, and we typically load two files in at once - both for separate colour channels, so over 32,000,000 pixels to process).
    As I am loading in multi-page tiff files, I am having to use the JAI (Java Advanced Imaging) toolkit. I use the following code to load in my multi-page tiff into a BufferedImage array, where each element of the array represents one of the 'pages' in the multi-page tiff file:
    SeekableStream stream = new FileSeekableStream(multiPageFile);
    String[] names = ImageCodec.getDecoderNames(stream);
    ImageDecoder dec = ImageCodec.createImageDecoder(names[0], stream, null);
    int numPages = dec.getNumPages();
    BufferedImage[] finalImage = new BufferedImage[numPages];
    for (int i=0; i<numPages; i++) {
         RenderedImage im = dec.decodeAsRenderedImage(i);
         finalImage[i] = PlanarImage.wrapRenderedImage(im).getAsBufferedImage();
         //...colour changing code currently here - loops through finalImage array, and on every pixel of every layer
    ...To be able to automatically convert the colour channel without having to loop on every pixel (and thus save an incredible amount of loading time) would be helpful.
    Thanks.

  • How to convert from PAL to NTSC in compressor

    I have a project I converted from mp4 file to Apple Pro Res to edit it in FCP.  I exported using Compressor and tried to import the files to DVD Studio Pro.  It said it can't put PAL files into an NTSC project.  I didn't even realize it was filmed in PAL (yes, I have the rights to use the footage).  How do I convert the files from PAL to put it into FCP...in Compressor?  If so, how?  Thanks for any help!

    Since you've already edited it, export from fcp (file:  export:  quicktime movie - NOT quicktime conversion) with current settings.  Bring this file into compressor and apply the appropriate dvd preset.  Thencustomize the preset, changing the frame rate to 29.97 fps and video format to ntsc in the encoder panel:  the pixel dimensions in the geometry panel to 720x480 (not sure if this is necessary, but doublecheck it).  Then in the frame controls panel, enable frame controls and change the resize filter to best, and rate conversion to 100% of source and rate conversion to best.  This may take a long time to output, so you might want to do a short test by setting an in and out in the compressor preview window.
    Hopefully, I haven't left anything out.  If there are any questions, post back.

Maybe you are looking for