<?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 Problem call DB2 stored procedure in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Problem-call-DB2-stored-procedure/m-p/148681#M39322</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to call a stored procedure in DB2 from SAS Base 9.2.&lt;/P&gt;&lt;P&gt;When I call a sp with only an IN argument it works as supposed, and I get the resultset I expect to get.&lt;/P&gt;&lt;P&gt;But when I try to call an extended version of the sp with the same IN argument, but an OUT parameter added I've got an IBM/DB2 CLI error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I use is this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;proc sql;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; connect to db2(database=&amp;amp;database user=&amp;amp;username password=&amp;amp;password); &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let out_status=2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; create table work.test as&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from connection to db2&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; (CALL "SC40ADMIN".SPC40_HAMTA_NASTA_LADD_ID(1234, :OUT_STATUS));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; disconnect from db2 ;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;quit;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;%put &amp;amp;out_status.;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This returns error:&lt;/P&gt;&lt;P&gt;ERROR: CLI prepare error: [IBM][CLI Driver][DB2/AIX64] SQL0313N&amp;nbsp; The number of host variables in the EXECUTE or OPEN statement is not equal to the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number of values required.&amp;nbsp; SQLSTATE=07004&lt;/P&gt;&lt;P&gt;SQL statement: CALL "SC40ADMIN".SPC40_HAMTA_NASTA_LADD_ID(1234, :OUT_STATUS).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried to follow the instructions in &lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a002594965.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a002594965.htm"&gt;SAS/ACCESS(R) 9.2 for Relational Databases: Reference, Fourth Edition&lt;/A&gt; and &lt;STRONG&gt;Stored Procedure That Passes Parameters&lt;/STRONG&gt; is very similar to what I want to achieve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jan 2014 09:30:17 GMT</pubDate>
    <dc:creator>emil_karlsson_ferrologic_se</dc:creator>
    <dc:date>2014-01-22T09:30:17Z</dc:date>
    <item>
      <title>Problem call DB2 stored procedure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-call-DB2-stored-procedure/m-p/148681#M39322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to call a stored procedure in DB2 from SAS Base 9.2.&lt;/P&gt;&lt;P&gt;When I call a sp with only an IN argument it works as supposed, and I get the resultset I expect to get.&lt;/P&gt;&lt;P&gt;But when I try to call an extended version of the sp with the same IN argument, but an OUT parameter added I've got an IBM/DB2 CLI error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I use is this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;proc sql;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; connect to db2(database=&amp;amp;database user=&amp;amp;username password=&amp;amp;password); &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let out_status=2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; create table work.test as&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from connection to db2&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; (CALL "SC40ADMIN".SPC40_HAMTA_NASTA_LADD_ID(1234, :OUT_STATUS));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; disconnect from db2 ;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;quit;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;%put &amp;amp;out_status.;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This returns error:&lt;/P&gt;&lt;P&gt;ERROR: CLI prepare error: [IBM][CLI Driver][DB2/AIX64] SQL0313N&amp;nbsp; The number of host variables in the EXECUTE or OPEN statement is not equal to the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number of values required.&amp;nbsp; SQLSTATE=07004&lt;/P&gt;&lt;P&gt;SQL statement: CALL "SC40ADMIN".SPC40_HAMTA_NASTA_LADD_ID(1234, :OUT_STATUS).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried to follow the instructions in &lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a002594965.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a002594965.htm"&gt;SAS/ACCESS(R) 9.2 for Relational Databases: Reference, Fourth Edition&lt;/A&gt; and &lt;STRONG&gt;Stored Procedure That Passes Parameters&lt;/STRONG&gt; is very similar to what I want to achieve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 09:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-call-DB2-stored-procedure/m-p/148681#M39322</guid>
      <dc:creator>emil_karlsson_ferrologic_se</dc:creator>
      <dc:date>2014-01-22T09:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem call DB2 stored procedure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-call-DB2-stored-procedure/m-p/148682#M39323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can only link query results to a &lt;EM&gt;from connection to&lt;/EM&gt; statment. I think that stored procedures can be called from &lt;EM&gt;execute&lt;/EM&gt; statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 15:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-call-DB2-stored-procedure/m-p/148682#M39323</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-01-22T15:44:44Z</dc:date>
    </item>
  </channel>
</rss>

