<?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 sql: catching oracle exception in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/proc-sql-catching-oracle-exception/m-p/511003#M15841</link>
    <description>&lt;P&gt;Got it: one must log return code in own macro as soon as it happens, otherwise it gets back to 0 in DI code when code execution continues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So... Example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  PROC SQL;
    CONNECT USING SEQLIB AS Oracle; 
      execute (execute &amp;amp;SCHEMA_NAME..&amp;amp;PACKAGE_NAME..&amp;amp;STORED_PROCEDURE.()) by oracle;
     &lt;STRONG&gt; %let RES=&amp;amp;sqlrc;&lt;/STRONG&gt;
    DISCONNECT FROM Oracle;
  QUIT;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ss&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &lt;STRONG&gt;&amp;amp;RES &amp;gt; 0&lt;/STRONG&gt; %then %do;
  %end_with_error;
%end;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Nov 2018 12:13:49 GMT</pubDate>
    <dc:creator>strsljen</dc:creator>
    <dc:date>2018-11-07T12:13:49Z</dc:date>
    <item>
      <title>proc sql: catching oracle exception</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/proc-sql-catching-oracle-exception/m-p/510730#M15829</link>
      <description>&lt;P&gt;Hei,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on User Written Transformation in SAS DI Studio which will handle Oracle packages/stored procedures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In that sense, I am trying to catch when&amp;nbsp; Oracle stored procedure raise an exception.&lt;/P&gt;&lt;P&gt;When that happens, I can stop the flow, continue, or something else..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the moment, I am unable to read from proc sql when stored procedure raises an exception, although I can see it in DI studio when job is running:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;- ERROR: ORACLE execute error: ORA-20020: This is a test application error / exception ORA-06512: ved "BUS_DATA_MAN_SANDBOX.DUMMY_PACKAGE", line 3 ORA-06512: ved line 1.&lt;/PRE&gt;&lt;P&gt;Is there a way to read some SAS macro variable to determinate when this happens?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or to read some proc sql return code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did try with &amp;amp;SQLRC and &amp;amp;job_rc, but these are 0 regardless.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 13:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/proc-sql-catching-oracle-exception/m-p/510730#M15829</guid>
      <dc:creator>strsljen</dc:creator>
      <dc:date>2018-11-06T13:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql: catching oracle exception</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/proc-sql-catching-oracle-exception/m-p/511003#M15841</link>
      <description>&lt;P&gt;Got it: one must log return code in own macro as soon as it happens, otherwise it gets back to 0 in DI code when code execution continues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So... Example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  PROC SQL;
    CONNECT USING SEQLIB AS Oracle; 
      execute (execute &amp;amp;SCHEMA_NAME..&amp;amp;PACKAGE_NAME..&amp;amp;STORED_PROCEDURE.()) by oracle;
     &lt;STRONG&gt; %let RES=&amp;amp;sqlrc;&lt;/STRONG&gt;
    DISCONNECT FROM Oracle;
  QUIT;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ss&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &lt;STRONG&gt;&amp;amp;RES &amp;gt; 0&lt;/STRONG&gt; %then %do;
  %end_with_error;
%end;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 12:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/proc-sql-catching-oracle-exception/m-p/511003#M15841</guid>
      <dc:creator>strsljen</dc:creator>
      <dc:date>2018-11-07T12:13:49Z</dc:date>
    </item>
  </channel>
</rss>

