<?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 Not able to insert sas date value into oracle table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866852#M342345</link>
    <description>Hi Team, &lt;BR /&gt;I tried a lot to insert sas date value into oracle date variable, but always giving ERROR: Oracle execute error: ORA-0140:  Cannot insert NULL into oracle table DATE field. &lt;BR /&gt;&lt;BR /&gt;Below is my code:&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table A as Select "28MAR2023" As src_dt from tmp;&lt;BR /&gt;&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table B as Select src_dt format=date9. from tmp;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;Proc append data=B &lt;BR /&gt;       Base=db1.tbl(sasdatefmt=(src_dt=date9.)) ;&lt;BR /&gt;Run;&lt;BR /&gt;Getting an error and code trying insert NULL value. Please suggest me how can I insert date value to oracle table date column. &lt;BR /&gt;</description>
    <pubDate>Tue, 28 Mar 2023 19:23:36 GMT</pubDate>
    <dc:creator>Banu</dc:creator>
    <dc:date>2023-03-28T19:23:36Z</dc:date>
    <item>
      <title>Not able to insert sas date value into oracle table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866852#M342345</link>
      <description>Hi Team, &lt;BR /&gt;I tried a lot to insert sas date value into oracle date variable, but always giving ERROR: Oracle execute error: ORA-0140:  Cannot insert NULL into oracle table DATE field. &lt;BR /&gt;&lt;BR /&gt;Below is my code:&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table A as Select "28MAR2023" As src_dt from tmp;&lt;BR /&gt;&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table B as Select src_dt format=date9. from tmp;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;Proc append data=B &lt;BR /&gt;       Base=db1.tbl(sasdatefmt=(src_dt=date9.)) ;&lt;BR /&gt;Run;&lt;BR /&gt;Getting an error and code trying insert NULL value. Please suggest me how can I insert date value to oracle table date column. &lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2023 19:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866852#M342345</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2023-03-28T19:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to insert sas date value into oracle table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866855#M342346</link>
      <description>Most DBs have datetime values, not just dates. Try creating a datetime variable instead of a date variable and inserting that. &lt;BR /&gt;&lt;BR /&gt;Create table A as Select dhms("28MAR2023"d, 0, 0, 0)  As src_dt format=datetime20. from tmp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2023 19:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866855#M342346</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-03-28T19:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to insert sas date value into oracle table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866862#M342351</link>
      <description>&lt;P&gt;Your first CREATE statement is make a CHARACTER variable.&lt;/P&gt;
&lt;P&gt;Your second CREATE statement is assuming that the variable SRC_DT in the TMP dataset is NUMERIC and has value are the number of days since 01JAN1960.&amp;nbsp; Otherwise you could not attach the numeric format DATE9. to the variable and have it print anything reasonable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Errors about NULL values sounds like perhaps the table in Oracle is defined with a NOT NULL constraint.&amp;nbsp; Do you have any missing values in the dataset B?&amp;nbsp; For which variables? Does dataset B have ALL of the variable that exist in the Oracle table TB1? Otherwise SAS will set those values to NULL, which might be the cause of the NULL value message.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 19:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866862#M342351</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-28T19:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to insert sas date value into oracle table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866863#M342352</link>
      <description>I even tried below steps. &lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table A as Select "28MAR2023" As src_dt from tmp;&lt;BR /&gt;&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table B as Select dhms(src_dt,0,0,0) as src_dt format=datetime20. from tmp;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;Proc append data=B&lt;BR /&gt;Base=db1.tbl(sasdatefmt=(src_dt=datetime20.)) ;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;In this case also same issue, I am not able to resolve.</description>
      <pubDate>Tue, 28 Mar 2023 19:49:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866863#M342352</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2023-03-28T19:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to insert sas date value into oracle table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866864#M342353</link>
      <description>Note the d after the date in my code that isn't in yours. That tells SAS that the value is a date, not just text.</description>
      <pubDate>Tue, 28 Mar 2023 19:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866864#M342353</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-03-28T19:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to insert sas date value into oracle table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866865#M342354</link>
      <description>I think you are right, need to verify the sas table columns and oracle table columns. And Yes src_dt is not null in my case. I will revisit my code and will get back you.</description>
      <pubDate>Tue, 28 Mar 2023 19:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Not-able-to-insert-sas-date-value-into-oracle-table/m-p/866865#M342354</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2023-03-28T19:53:34Z</dc:date>
    </item>
  </channel>
</rss>

