<?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: proc append into ORACLE (NOT NULL &amp; DEFAULT constraint) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134091#M27249</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We had som difficulties with default constraints in SQL Server.&lt;/P&gt;&lt;P&gt;I think we solved by using IGNORE_READ_ONLY_COLUMNS=YES libname option.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 May 2013 07:51:43 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2013-05-15T07:51:43Z</dc:date>
    <item>
      <title>proc append into ORACLE (NOT NULL &amp; DEFAULT constraint)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134087#M27245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using proc append to load data into an Oracle table (using SAS/ACCESS). One column of the oracle table is defined as NOT NULL with DEFAULT 'S'.&lt;/P&gt;&lt;P&gt;But this column doesn't exist in the SAS Table which shall be loaded into Oracle and here the problem starts.&lt;/P&gt;&lt;P&gt;I thought that for this column the default value shall be assigned but SAS taught me otherwise. A blank character is inserted. I've already looked for possible sas options (NULLCHAR, NULLCHARVAL, DBNULL etc.) but it doesn't work..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below a simple example:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;ORACLE Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;CREATE TABLE TEST&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; NUM NUMBER(4)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOT NULL,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; COD VARCHAR2(1 CHAR) DEFAULT 'S' NOT NULL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; text-decoration: underline;"&gt;&lt;STRONG&gt;SAS Table:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data TMP;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; NUM = 198;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;SAS-Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;libname orahome oracle path=&amp;amp;ORAPATH schema=&amp;amp;ORASCHEMA user=&amp;amp;ORAUSER password="&amp;amp;ORAPASS";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;options sastrace=',,,dsa' sastraceloc=saslog;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;proc append base = orahome.TEST&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = TMP;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have a glue how to tell SAS not to automatically add the missing column in Oracle to the INSERT statement and use instead the DBMS mechanism?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Log shows that there is a INSERT statemend generated with all columns existing in ORACLE:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;INSERT&amp;nbsp; INTO TMP_COAL_COLLATERAL_PUA &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;("NUM","COD") VALUES &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;(:"NUM",:"COD")&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;It seems that SAS is adding the missing column with a blank value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Any hints for solving this issue would be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Thx Arnold&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 17:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134087#M27245</guid>
      <dc:creator>puntigama</dc:creator>
      <dc:date>2013-05-14T17:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc append into ORACLE (NOT NULL &amp; DEFAULT constraint)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134088#M27246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using PROC APPEND use the generated syntax, modified to exclude the missing column that you want to take as default.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 17:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134088#M27246</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-05-14T17:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: proc append into ORACLE (NOT NULL &amp; DEFAULT constraint)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134089#M27247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should maybe have a look at the &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002518172.htm"&gt;COALESCE function&lt;/A&gt; that allows you to replace any empty value of a field with a default value. To exclude any row having missing values for a column, I would use the same method as suggested by Peter.C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Florent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 17:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134089#M27247</guid>
      <dc:creator>Florent</dc:creator>
      <dc:date>2013-05-14T17:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: proc append into ORACLE (NOT NULL &amp; DEFAULT constraint)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134090#M27248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply. Of course this would be an option. We have lot's of such transfers and sometimes the database model of the Oracle DB is modified weeks or months before we implement these changes. That's the reason why we differ in table structure. I thaught that there would be a simple option to do this (there are tons of options and maybe I've overseen one). But it seems I have to code it via checking the differences based on the dictionary information and generate a INSERT statement by myself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx anyhow!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 06:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134090#M27248</guid>
      <dc:creator>puntigama</dc:creator>
      <dc:date>2013-05-15T06:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: proc append into ORACLE (NOT NULL &amp; DEFAULT constraint)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134091#M27249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We had som difficulties with default constraints in SQL Server.&lt;/P&gt;&lt;P&gt;I think we solved by using IGNORE_READ_ONLY_COLUMNS=YES libname option.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 07:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134091#M27249</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-05-15T07:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc append into ORACLE (NOT NULL &amp; DEFAULT constraint)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134092#M27250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your suggestions.&lt;/P&gt;&lt;P&gt;Finally I did it by adding the default column which only exists in the Oracle Table but at the moment not in the SAS table to the drop dataset option for the oracle table within the proc append procedure.&lt;/P&gt;&lt;P&gt;This prevents SAS to add this column in the INSERT statement.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;options sastrace=',,,dsa' sastraceloc=saslog;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;proc append base = orahome.TEST (DROP = COD) &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = TMP;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The INSERT statement then looks like the following:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;INSERT&amp;nbsp; INTO TMP_COAL_COLLATERAL_PUA &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;("NUM") VALUES &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;(:"NUM")&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Cheers Arnold&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2013 16:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134092#M27250</guid>
      <dc:creator>puntigama</dc:creator>
      <dc:date>2013-05-21T16:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc append into ORACLE (NOT NULL &amp; DEFAULT constraint)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134093#M27251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS doesn't have a concept of a NULL value and a missing character value is a Blank.&lt;/P&gt;&lt;P&gt;I believe you found a clever and simple way to get around this without using pass-through SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The one thing to consider: If you're having this column also in your source data (and you didn't just add it initially for loading) then the column could in a later phase be populated. Using a coalesce() function like Florent suggests and replace missings with the Oracle default of 'S' could save you from changing code in a later stage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On a related note:&lt;/P&gt;&lt;P&gt;I've tried lately to implement an Oracle table with a primary key which gets automatically incremented when adding data to the table (using a trigger). This worked beautifully when using SQL Insert but I couldn't make it work when using bulk loading (with my limited Oracle skills). Are you bulk loading as well and is this Not Null constraint with default value then still working?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 09:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/134093#M27251</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-05-22T09:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc append into ORACLE (NOT NULL &amp; DEFAULT constraint)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/858445#M339173</link>
      <description>nice trick</description>
      <pubDate>Sun, 12 Feb 2023 16:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-into-ORACLE-NOT-NULL-DEFAULT-constraint/m-p/858445#M339173</guid>
      <dc:creator>abdelbaki22</dc:creator>
      <dc:date>2023-02-12T16:36:17Z</dc:date>
    </item>
  </channel>
</rss>

