<?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: Using SQL Pass-Through to retrieve data for one organization in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289926#M59690</link>
    <description>&lt;P&gt;Are you running the EXECUTE and the query in the same Oracle CONNECT step? If not, please try it.&lt;/P&gt;</description>
    <pubDate>Sat, 06 Aug 2016 03:52:09 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2016-08-06T03:52:09Z</dc:date>
    <item>
      <title>Using SQL Pass-Through to retrieve data for one organization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289835#M59682</link>
      <description>&lt;P&gt;I have an Oracle table I would like to acces in SAS but using either the datastep or proc sql it returns the column headers but no rows of data.&amp;nbsp; In SQL developer the same issue occurs, but I am able to resolve it by first running the SQL command below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;begin&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;apps.mo_global.set_policy_context('S',101);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;end;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to run that exact SQL statement using the SQL pass-through facility as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;proc sql; &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;connect to oracle as ALIAS (user=username orapw=password path='path');&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;execute(begin &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;apps.mo_global.set_policy_context('S',org#); &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;end; ) by ALIAS;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;disconnect from ALIAS;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;quit;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is that whenever I run this I get an error that the table or view does not exist.&amp;nbsp; I do not know if there the problem is with my proc sql or if there is other code that is the SAS equivalent of the SQL command above.&amp;nbsp; I have tried it in both SAS 9.3 and Enterprise Guide 5.1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 16:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289835#M59682</guid>
      <dc:creator>leviathand</dc:creator>
      <dc:date>2016-08-05T16:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using SQL Pass-Through to retrieve data for one organization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289885#M59684</link>
      <description>I don't know about this error, but an execute block will not return anything to the SAS session. &lt;BR /&gt;What do you mean by "column headers"?&lt;BR /&gt;Perhaps there's some data dictionary tables that you could query using a select clause instead?</description>
      <pubDate>Fri, 05 Aug 2016 21:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289885#M59684</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-08-05T21:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using SQL Pass-Through to retrieve data for one organization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289888#M59685</link>
      <description>I can see why that wasn't clear. If I run a general query using a select clause I get an empty dataset. So all of the variables in the view returned, but no observations. That is what I meant by "column headers". Does this make sense?&lt;BR /&gt;&lt;BR /&gt;I am attempting to use the execute clause to pass the SQL command directly through SAS so that I can then query the database and have data returned. That is where the error I described is coming up.&lt;BR /&gt;&lt;BR /&gt;Thank you.</description>
      <pubDate>Fri, 05 Aug 2016 21:34:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289888#M59685</guid>
      <dc:creator>leviathand</dc:creator>
      <dc:date>2016-08-05T21:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using SQL Pass-Through to retrieve data for one organization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289922#M59687</link>
      <description>&lt;P&gt;Your&amp;nbsp;set_policy_context code is different between the Oracle version and the SAS one. Is that correct or is it a typo?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Aug 2016 03:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289922#M59687</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-08-06T03:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using SQL Pass-Through to retrieve data for one organization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289923#M59688</link>
      <description>&lt;P&gt;What you're trying to do should be possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi﻿&lt;/a&gt;&amp;nbsp;already points out: Make sure that you run exactly the same code via Pass-through SQL than what you're using in SQL Developer (or the like).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you always using the same user and password?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also make sure that once your first statement works that you issue your queries within the same session/connection.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Aug 2016 03:23:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289923#M59688</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-08-06T03:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using SQL Pass-Through to retrieve data for one organization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289924#M59689</link>
      <description>I'm sorry, that's a typo. The command should be the same</description>
      <pubDate>Sat, 06 Aug 2016 03:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289924#M59689</guid>
      <dc:creator>leviathand</dc:creator>
      <dc:date>2016-08-06T03:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using SQL Pass-Through to retrieve data for one organization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289926#M59690</link>
      <description>&lt;P&gt;Are you running the EXECUTE and the query in the same Oracle CONNECT step? If not, please try it.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Aug 2016 03:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/289926#M59690</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-08-06T03:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using SQL Pass-Through to retrieve data for one organization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/291713#M59912</link>
      <description>&lt;P&gt;Hi, this seemed to solve the problem.&amp;nbsp; Running them in the same Oracle CONNECT step each time worked.&amp;nbsp; Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 15:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-SQL-Pass-Through-to-retrieve-data-for-one-organization/m-p/291713#M59912</guid>
      <dc:creator>leviathand</dc:creator>
      <dc:date>2016-08-15T15:48:29Z</dc:date>
    </item>
  </channel>
</rss>

