<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Working with Oracle BLOB in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34719#M6848</link>
    <description>There must be some way around this limitation.  SAS indicates it can access BLOBs up to 2gig.</description>
    <pubDate>Wed, 20 May 2009 19:26:07 GMT</pubDate>
    <dc:creator>DanK</dc:creator>
    <dc:date>2009-05-20T19:26:07Z</dc:date>
    <item>
      <title>Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34717#M6846</link>
      <description>I am accessing an Oracle table having a column of type BLOB.  The contents of the BLOB is a 55768 byte string of characters.  I am using PROC SQL to get one row, then I use a DATA step to parse through the string of characters using SUBSTR and known offsets.  See sections of SASLOG below.&lt;BR /&gt;
&lt;BR /&gt;
Can someone tell me how to expose the enire contents of the BLOB so I can parse out the data?&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
DanK&lt;BR /&gt;
&lt;BR /&gt;
proc sql;                                                                              &lt;BR /&gt;
    connect to oracle (user=xxxxxxxx orapw=XXXXXXXX path="xxxxxxxx" dbmax_text=32765);  &lt;BR /&gt;
                                                                                              &lt;BR /&gt;
create table application_fdata as                                                 &lt;BR /&gt;
        select *                                                                       &lt;BR /&gt;
           from connection to oracle                                                       &lt;BR /&gt;
             ( select fdata_keycode,                                                     &lt;BR /&gt;
                        fdata_app                                                          &lt;BR /&gt;
                 from cmlbrc.application_fdata                                           &lt;BR /&gt;
                 where fdata_keycode='SAMKAXAA84'                                        &lt;BR /&gt;
             );                                                                         &lt;BR /&gt;
NOTE: Table WORK.APPLICATION_FDATA created, with 1 rows and 2 columns.                        &lt;BR /&gt;
&lt;BR /&gt;
data xtbl;                                    &lt;BR /&gt;
set application_fdata;                        &lt;BR /&gt;
                                              &lt;BR /&gt;
DET_KEYCODECENTER =substr(fdata_app,51-50,10);&lt;BR /&gt;
RD_KEYCODE =substr(fdata_app,55-50,6);        &lt;BR /&gt;
DET_BUS_NAME_1 =substr(fdata_app,61-50,1);    &lt;BR /&gt;
DET_BUS_NAME_A =substr(fdata_app,61-50,4);    &lt;BR /&gt;
DET_BUS_NAME_B =substr(fdata_app,61-50,7);    &lt;BR /&gt;
DET_BUS_NAME =substr(fdata_app,61-50,48);     &lt;BR /&gt;
DET_BUS_NAME_2 =substr(fdata_app,61-50,48);   &lt;BR /&gt;
CLI_CLIENT_ID =substr(fdata_app,109-50,1);    &lt;BR /&gt;
CLI_CLIENT_ID_1 =substr(fdata_app,109-50,1);  &lt;BR /&gt;
CLI_CLIENT_ID_12 =substr(fdata_app,110-50,12);&lt;BR /&gt;
LOG_CLIENT_ID =substr(fdata_app,110-50,12);   &lt;BR /&gt;
EQ_NO_HIT_IND =substr(fdata_app,122-50,1);    &lt;BR /&gt;
DBUS_NO_HIT_IND =substr(fdata_app,123-50,1);  &lt;BR /&gt;
EXPB_NO_HIT_IND =substr(fdata_app,124-50,1);  &lt;BR /&gt;
DET_CBR_PULL =substr(fdata_app,125-50,1);     &lt;BR /&gt;
DET_STATUS =substr(fdata_app,126-50,18);      &lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
EQCA_BUREAU_DOWN_FLAG =substr(fdata_app,55761-50,1);   &lt;BR /&gt;
DBCA_BUREAU_DOWN_FLAG =substr(fdata_app,55762-50,1);   &lt;BR /&gt;
TUCA_BUREAU_DOWN_FLAG =substr(fdata_app,55763-50,1);   &lt;BR /&gt;
CRED_BUREAU_DOWN_FLAG =substr(fdata_app,55764-50,1);   &lt;BR /&gt;
SBE_BUREAU_DOWN_FLAG =substr(fdata_app,55765-50,1);    &lt;BR /&gt;
DNB_BUREAU_DOWN_FLAG =substr(fdata_app,55766-50,1);    &lt;BR /&gt;
EXPB_BUREAU_DOWN_FLAG =substr(fdata_app,55767-50,1);   &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Observation length 179093500 too large for file WORK.XTBL.DATA.  Maximum allowed for this file is 16777191. &lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.</description>
      <pubDate>Wed, 20 May 2009 17:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34717#M6846</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-20T17:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34718#M6847</link>
      <description>Hi DanK&lt;BR /&gt;
Length of SAS character variable can't be more than 32K (32765)&lt;BR /&gt;
in proc sql it's truncated to 32K&lt;BR /&gt;
when you try to use substr with second parameter &amp;gt;32K, you get ERROR.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
lu</description>
      <pubDate>Wed, 20 May 2009 19:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34718#M6847</guid>
      <dc:creator>lu</dc:creator>
      <dc:date>2009-05-20T19:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34719#M6848</link>
      <description>There must be some way around this limitation.  SAS indicates it can access BLOBs up to 2gig.</description>
      <pubDate>Wed, 20 May 2009 19:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34719#M6848</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-20T19:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34720#M6849</link>
      <description>Searched and found this item on the SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website:&lt;BR /&gt;
&lt;BR /&gt;
Problem Note 35928: An error occurs when you access data of types BLOB and CLOB from a DB2 table&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/35/928.html" target="_blank"&gt;http://support.sas.com/kb/35/928.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 20 May 2009 19:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34720#M6849</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-20T19:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34721#M6850</link>
      <description>I meant to say that the DB2 reference may be useful information.  Also, the SAS/Access for Oracle 9.2 DOC specifically mentions CLOB/BLOB data types:&lt;BR /&gt;
&lt;BR /&gt;
Data Types for Oracle&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/61890/HTML/default/a003113620.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/acreldb/61890/HTML/default/a003113620.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 20 May 2009 19:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34721#M6850</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-20T19:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34722#M6851</link>
      <description>Thank you.  I have looked though support.sas.com and Oracle forums looking for an answer.  It's odd that SAS will state in the same document that a BLOB can store up to 2gig but it can only reference 32k of it. &lt;BR /&gt;
&lt;BR /&gt;
There must be some work around for this.  I am thinking I need to learn how to write a small C or Java program to dump the BLOB of interest to a flat file, invoke it from my SAS program then read the file with SAS.  Grrrrrr.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Dan</description>
      <pubDate>Wed, 20 May 2009 19:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34722#M6851</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-20T19:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34723#M6852</link>
      <description>Suggest you open a SAS support tracking issue, given the situation.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 20 May 2009 21:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34723#M6852</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-20T21:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34724#M6853</link>
      <description>Maybe storing the blob value in a macro variable using select ... into would work, since your blobs are less than 64k. Then you can work on it using the macro language. &lt;BR /&gt;
&lt;BR /&gt;
But if sas supports larger blobs, then there might indeed be a better solution and tech support should be able to tell you. Also, a macro variable might not handle binary values perfectly, but it doesn't hurt to try...&lt;BR /&gt;
&lt;BR /&gt;
Another way would be to read the blob in chuncks smaller than 32k, using oracle's substring function. That would be much better than dumping into a text file!

Message was edited by: C. Graffeuille</description>
      <pubDate>Thu, 21 May 2009 10:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34724#M6853</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-21T10:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34725#M6854</link>
      <description>Could you not use the substr function in the passthru sql and bring back the long string in parts?</description>
      <pubDate>Thu, 21 May 2009 13:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34725#M6854</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2009-05-21T13:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34726#M6855</link>
      <description>I tried this too.  This is a SAS limitation that will only expose 32k of the BLOB.  I have requested a fix from SAS as the 32k limitation seems useless when the BLOB could contain 2gig.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Dan</description>
      <pubDate>Thu, 21 May 2009 14:09:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34726#M6855</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-21T14:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34727#M6856</link>
      <description>If someone has a C program that I could use to read an Oracle table to return a BLOB and write it to a flat file, that would be great.  The contents of this BLOB is a 64k text string.</description>
      <pubDate>Thu, 21 May 2009 14:15:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34727#M6856</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-21T14:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34728#M6857</link>
      <description>If someone has a C program that I could use to read an Oracle table to return a BLOB and write it to a flat file, that would be great.  The contents of this BLOB is a 64k text string.</description>
      <pubDate>Thu, 21 May 2009 14:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34728#M6857</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-21T14:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34729#M6858</link>
      <description>I think you may have missed BIll's point.&lt;BR /&gt;
 &lt;BR /&gt;
SAS should not stop you using oracle substring functions in explicit-pass-thru sql.&lt;BR /&gt;
           select * from connection to oracle (&lt;BR /&gt;
     select substr( blob,1,32000 ) as blob1, substr( blob, 32001,32000 ) as blob2&lt;BR /&gt;
              )&lt;BR /&gt;
was what Bill's idea suggested to me.&lt;BR /&gt;
 &lt;BR /&gt;
Or has this approach already failed?&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Thu, 21 May 2009 15:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34729#M6858</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-05-21T15:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34730#M6859</link>
      <description>I did miss the point.  I just tried and got a data type error.&lt;BR /&gt;
&lt;BR /&gt;
15   proc sql;&lt;BR /&gt;
16      connect to oracle (user=xxxxxxxx orapw=XXXXXXXX path="xxxxxxxx" dbmax_text=32767);&lt;BR /&gt;
&lt;BR /&gt;
17        create table application_fdata as&lt;BR /&gt;
18           select *&lt;BR /&gt;
19          from connection to oracle&lt;BR /&gt;
20              ( select substr(fdata_app,1,32000) as blob1, substr(fdata_app,32001,2000) as blob2&lt;BR /&gt;
21                  from cmlbrc.application_fdata&lt;BR /&gt;
22                  where fdata_keycode='SAMKAXAA84'&lt;BR /&gt;
23               );&lt;BR /&gt;
ERROR: ORACLE prepare error: ORA-00932: inconsistent datatypes: expected NUMBER got BLOB. SQL statement: select&lt;BR /&gt;
       substr(fdata_app,1,32000) as blob1, substr(fdata_app,32001,2000) as blob2 from cmlbrc.application_fdata where&lt;BR /&gt;
       fdata_keycode='SAMKAXAA84'.&lt;BR /&gt;
24   run;</description>
      <pubDate>Thu, 21 May 2009 15:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34730#M6859</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-21T15:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34731#M6860</link>
      <description>you will need to adapt the substr() usage from my SAS style into syntax valid for oracle.&lt;BR /&gt;
 &lt;BR /&gt;
peterC</description>
      <pubDate>Thu, 21 May 2009 16:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34731#M6860</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-05-21T16:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34732#M6861</link>
      <description>I tried the same statement directly in Oracle SQL Developer and got the same ORA-00932 error.  I have no clue on how to get around this.</description>
      <pubDate>Thu, 21 May 2009 17:05:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34732#M6861</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-21T17:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34733#M6862</link>
      <description>-----Original Message-----&lt;BR /&gt;
From: SAS Technical Support [mailto:support@sas.com] &lt;BR /&gt;
Sent: Thursday, May 21, 2009 1:18 PM&lt;BR /&gt;
To: Kanze, Daniel R (GE Money)&lt;BR /&gt;
Subject: [SAS 7610215082] Reading Oracle BLOB&lt;BR /&gt;
&lt;BR /&gt;
Dan,&lt;BR /&gt;
Yes,  I will open a defect requesting and enhancement for a future release.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Donna&lt;BR /&gt;
SAS Technical Support</description>
      <pubDate>Thu, 21 May 2009 17:22:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34733#M6862</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-21T17:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34734#M6863</link>
      <description>You might need to convert the blob to a string (if oracle can do this) as substr probably does not take blobs as argument.</description>
      <pubDate>Fri, 22 May 2009 01:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34734#M6863</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-22T01:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34735#M6864</link>
      <description>I tried to_char(blob) in an Oracle select but that did not solve the problem.  substr(blob,1,32000) works in SAS after retrieving the data from Oracle but select substr(blob,1,3200) as myblob will not work in a select statement.&lt;BR /&gt;
&lt;BR /&gt;
Someone, somewhere has delt with this issue and solved it.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Dan</description>
      <pubDate>Fri, 22 May 2009 12:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34735#M6864</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2009-05-22T12:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Oracle BLOB</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34736#M6865</link>
      <description>I suggest that you post you problem on a Oracle forum instead, since it's quite clear this could not be solved with any SAS specific tool. Probably both suggested ways are feasible (substr and export to text-file).&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Tue, 26 May 2009 10:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Oracle-BLOB/m-p/34736#M6865</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-05-26T10:25:35Z</dc:date>
    </item>
  </channel>
</rss>

