<?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: Use the results of a Pass Through query in another Pass Through query in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443299#M28634</link>
    <description>&lt;P&gt;can do create final tables in multiple steps in oracle by using global temporary table and then can access those tables outside of connect by using libname method. I have not tested any of this and it has been while I did something like this in oracle. but you will get the idea. I know &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp;is well versed with oracle pass through. l would like to hear what he thinks on this and what would be his suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to oracle as ora (path="(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)
(HOST = xxxxxxxxxxxxxxx.com)(PORT = 1234))
(CONNECT_DATA = (SERVICE_NAME=xxxxxxxx)))" 
user=xxxxxx pw=xxxxxxxx connection =global);

excute( create global temporary table xyz as 
select distinct
A.ID

from QUERY A
LEFT JOIN QUERY_NEXT B
ON A.ID = B.ID) on commit preserve rows;
execute(commit) by oracle;

/*Is it possible to add code here to export the data back to another location?*/
excute( create global temporary table hello as 
select * from xyz
where name ='whatever') on commit preserve rows;
execute(commit) by oracle;



/*--------------------------------------------------*/

);
disconnect from ora;
quit;




/* you can use this temporary table by libname and create your sas table */


libname oradb oracle user=scott pw=tiger path=lupin connection=global dbtemp = yes;

proc sql;
create table work.table_you_want as select * from oradb.hello ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2018 13:59:01 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2018-03-07T13:59:01Z</dc:date>
    <item>
      <title>Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443179#M28609</link>
      <description>&lt;P&gt;Hi Forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS EG 7.1 with Windows 7.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 large tables, one with 100,000s of records &amp;amp; one with millions of records that I access via an Oracle Pass Through query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To keep the time taken to run down, I've firstly created a Pass Through that extracts the common data between the 2 tables reducing the data to 60K uniq IDs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now want to use that data as a join in a new Pass Through so I can get some more fields from these large tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The plan is that the tables now only need to check 60K of records instead of the entire table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, a subquery still takes too long to run &amp;amp; when I try to add the extracted dataset in the Pass Through, it's not recognised&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder if the 60K of Unique IDs can be saved somewhere (Temp table?) so It will be usable in the second Pass Through?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 06:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443179#M28609</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T06:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443180#M28610</link>
      <description>&lt;P&gt;This may help explain my issue;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a thought that if a temp table isn't an option, maybe an export to a new location may be an answer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just thinking of any possibilities.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to oracle as ora (path="(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)
(HOST = xxxxxxxxxxxxxxx.com)(PORT = 1234))
(CONNECT_DATA = (SERVICE_NAME=xxxxxxxx)))" 
user=xxxxxx pw=xxxxxxxx);

create table WORK.xxxxxxxxx as select * from connection to ora
(
select distinct
A.ID

from QUERY A
LEFT JOIN QUERY_NEXT B
ON A.ID = B.ID

/*-----------------------------------------------*/

/*Is it possible to add code here to export the data back to another location?*/

/*--------------------------------------------------*/

);
disconnect from ora;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 06:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443180#M28610</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T06:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443181#M28611</link>
      <description>&lt;P&gt;yes this done easily. below is sample code for teradata but in oracle there is global temporary table which you can use. below code creates 2 temporary tables and then creates final table. please look into the paper given below. even though it is mostly for teradata, can be easily implied to oracle.&amp;nbsp;&amp;nbsp;&lt;A href="http://analytics.ncsu.edu/sesug/2017/SESUG2017_Paper-57_Final_PDF.pdf" target="_blank"&gt;http://analytics.ncsu.edu/sesug/2017/SESUG2017_Paper-57_Final_PDF.pdf&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to teradata (server=myserver user=myuserid pw=mypass connection = global);
/* 1st volatile table created*/
execute(create volatile table staging_customer as
select * from edwwrkuser.Cusomter table
where create_dt between ‘2017-01-01’ and ‘2017-01-31’ )
with data primary index(cust_id)on commit preserve rows) by teradata;
execute(commit work) by teradata;
/* second Teradata table creation is not shown*/
/* final Teradata table to be created*/
execute(create volatile table Final_cust_txn
select a.* , b.txn_id from staging_customer a
inner join
staging_txn_tbl
on a.cust_id =b.cust_id)
with data no primary index on commit preserve rows)by teradata;
execute(commit work) by Teradata;
disconnect from teradata;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 06:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443181#M28611</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-03-07T06:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443182#M28612</link>
      <description>&lt;P&gt;Thanks kiranv,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's the sort of solution I'm after.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me give it a try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 06:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443182#M28612</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T06:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443192#M28613</link>
      <description>&lt;P&gt;Hi kiranv,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you able to use my posted code to show me the correct Oracle syntax for this or suggest an article I could check?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having some trouble blending the two together.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No worries if you're a Teradata user, I am too &amp;amp; I'm trying to get this right nit having used Teradata for a while.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 07:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443192#M28613</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T07:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443299#M28634</link>
      <description>&lt;P&gt;can do create final tables in multiple steps in oracle by using global temporary table and then can access those tables outside of connect by using libname method. I have not tested any of this and it has been while I did something like this in oracle. but you will get the idea. I know &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp;is well versed with oracle pass through. l would like to hear what he thinks on this and what would be his suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to oracle as ora (path="(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)
(HOST = xxxxxxxxxxxxxxx.com)(PORT = 1234))
(CONNECT_DATA = (SERVICE_NAME=xxxxxxxx)))" 
user=xxxxxx pw=xxxxxxxx connection =global);

excute( create global temporary table xyz as 
select distinct
A.ID

from QUERY A
LEFT JOIN QUERY_NEXT B
ON A.ID = B.ID) on commit preserve rows;
execute(commit) by oracle;

/*Is it possible to add code here to export the data back to another location?*/
excute( create global temporary table hello as 
select * from xyz
where name ='whatever') on commit preserve rows;
execute(commit) by oracle;



/*--------------------------------------------------*/

);
disconnect from ora;
quit;




/* you can use this temporary table by libname and create your sas table */


libname oradb oracle user=scott pw=tiger path=lupin connection=global dbtemp = yes;

proc sql;
create table work.table_you_want as select * from oradb.hello ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 13:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443299#M28634</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-03-07T13:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443308#M28636</link>
      <description>&lt;P&gt;You can always combine queries as below. That's certainly as fast as first running the inner query, storing it in some table and then use this table for the next query.&lt;/P&gt;
&lt;P&gt;Look at the query bit in brackets as an implicit view.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table want as
  select 
    outer.*&lt;BR /&gt;    table3 outer
    left join
      (
        your current query joining two tables
      ) inner
    on outer.blah=inner.blah&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 14:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443308#M28636</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-07T14:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443352#M28639</link>
      <description>&lt;P&gt;It seems to me like, your trying to avoid Heterogeneous joins between SAS Table and Oracle tables. The best approach is load the SAS table(Just the Key variables you need) into permanent table in Oracle and then run pass-through for in-database query. Most of the environments will not allow user to create permanent tables in PROD, in this situation check whether you can create a GLOBAL TEMPORARY table for Oracle or MULTISET VOLATILE TABLE in Teradata. If yes, then load the Key variable values for 60K into temp table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: Loading data into temp table is not as fast as loading data into permanent table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname ora oracle user= pw= path= connection=global DBMSTEMP=YES;
  proc sql;
  connect to oracle (user= pw= path= connection=global);
   execute (create global temporary table TEMP
       (ID number) on commit preserve rows) by oracle;
  quit;

proc append base=ora.TEMP(Bulkload=YES) data=SAS_DATASET;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Remember to keep &lt;STRONG&gt;CONNECTION=GLOBAL&lt;/STRONG&gt; and &lt;STRONG&gt;ON COMMIT PRESERVE ROWS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 15:26:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443352#M28639</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-07T15:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443499#M28650</link>
      <description>&lt;P&gt;Thanks Patrick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried a subquery but it is still far to slow to help in this situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 20:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443499#M28650</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T20:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443513#M28654</link>
      <description>&lt;P&gt;Reading your original post again: You're first joining the two tables to get the common keys and then you want to join again to the one big table to get additional columns. That won't speed up things.&lt;/P&gt;
&lt;P&gt;Just join the two tables and get all the columns you want in a single select statement. If the join is too slow then reformulate your join condition; ideally in a way that it can use existing indeces and if this doesn't exist then by trying to avoid OR conditions or and by using the comparisons which will be rarely true first in your condition (so the rest doesn't need testing anymore).&lt;/P&gt;
&lt;P&gt;If using pass-through look also into Oracle hints allowing you to tell Oracle to execute the query in parallel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And last but not least: Make sure you set option READBUFF to a bigger value than installation default because may-be the time consuming part is not your query on the Oracle side but the data transfer from Oracle to SAS.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 21:13:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443513#M28654</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-07T21:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443522#M28657</link>
      <description>&lt;P&gt;Thanks to all for your input so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suryakiran, I've changed your code to do what I think I need to do to get the connection right, can you advise if it's correct or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, I have HOST &amp;amp; PATH in my connection criteria, how do I adapt it to a Global Temp criteria.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;libname&lt;/SPAN&gt; ora oracle user&lt;SPAN class="token operator"&gt;=xxxxxxxx&lt;/SPAN&gt; pw&lt;SPAN class="token operator"&gt;=xxxxxxx&lt;/SPAN&gt; path&lt;SPAN class="token operator"&gt;= ?&lt;BR /&gt;(HOST = XXXXXXXXXXXXXXX.com)&lt;/SPAN&gt; (PORT = 1234)&lt;BR /&gt;connection&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;global DBMSTEMP&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;YES&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
connect to oracle &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;user&lt;SPAN class="token operator"&gt;=XXXXXXXX&lt;/SPAN&gt; pw&lt;SPAN class="token operator"&gt;=XXXXXXXX&lt;/SPAN&gt; path&lt;SPAN class="token operator"&gt;= ?&lt;/SPAN&gt; &lt;BR /&gt;connection&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;global&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;BR /&gt;   &lt;SPAN class="token keyword"&gt;execute&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;create global temporary &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; TEMP
       &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;ID&lt;/SPAN&gt; number&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; on commit preserve rows&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; oracle&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;append&lt;/SPAN&gt; base&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;ora&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;TEMP&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;Bulkload&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;YES&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;SAS_DATASET&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&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 Mar 2018 21:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443522#M28657</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T21:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443528#M28658</link>
      <description>&lt;P&gt;Your are using a complex type of connection instead of defining your connection entries in tnsnames.ora. Work with your DBA to set up the tnsnames.ora for connecting to oracle with less hassle. Anyways if you prefer this way then check this LIBNAME&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname oralib1 oracle path="(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST =)(PORT = ))
(CONNECT_DATA = (SERVICE_NAME=)))" user=myuser password=mypasswd connection=global dbmstemp=yes;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For more information take a look at this topic:&amp;nbsp;&lt;A title="A quick guide to connecting to Oracle from SAS" href="https://communities.sas.com/t5/tkb/articleprintpage/tkb-id/library/article-id/1795" target="_self"&gt;A quick guide to connecting to Oracle from SAS&lt;/A&gt;&amp;nbsp;by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51161"&gt;@JBailey&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 21:45:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443528#M28658</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-07T21:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443529#M28659</link>
      <description>&lt;P&gt;Thanks Suryakiran,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That worked or at least didn't error, so I assume I now have created a temp table because there's no visible result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I now insert my records from a query into this table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 22:04:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443529#M28659</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T22:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443533#M28660</link>
      <description>&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;/* This Query will only create an empty table */&lt;BR /&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
connect to oracle &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;user&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;XXXXXXXX pw&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;XXXXXXXX path&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; ? connection&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;global&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="token keyword"&gt;execute&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;create global temporary &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; TEMP
       &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;ID&lt;/SPAN&gt; number&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; on commit preserve rows&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; oracle&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
/* Insert records into temp table using PROC APPEND */
&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;append&lt;/SPAN&gt; base&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;ora&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;TEMP&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;Bulkload&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;YES&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;SAS_DATASET&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 22:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443533#M28660</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-07T22:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443536#M28662</link>
      <description>&lt;P&gt;Thanks, should I be adding a select statement after 'data=' in order to get results?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 22:26:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443536#M28662</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T22:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443539#M28663</link>
      <description>&lt;P&gt;There is no such select statement for PROC APPEND. There are many ways to load data into Temp table one method is PROC APPEND. If you want to see the table then use the data set&amp;nbsp; or run select query from PROC SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ora.temp(BULKLOAD=YES BL_DELETE_DATAFILE=YES);&lt;/P&gt;&lt;P&gt;set &amp;lt;sasdataset&amp;gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You need BL_DELETE_DATAFILE=YES to delete .dat, .ctl and .log files which are by default created when you use BULKLOAD.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 22:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443539#M28663</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-07T22:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443541#M28664</link>
      <description>&lt;P&gt;Thanks so to see my temp table results, I should use the below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname oralib1 oracle path="(DESCRIPTION=(ADDRESS =
(PROTOCOL = TCP)(HOST =xxxxxxxxxxxx.com)(PORT =1234 ))
(CONNECT_DATA = (SERVICE_NAME=xxxxxx)))"
user=xxxxxxxx pw=xxxxxxxxx connection=global dbmstemp=yes;

/* This Query will only create an empty table */
proc sql;
connect to oracle (user=xxxxxx pw=xxxxxx connection=global);
   execute (create global temporary table TEMP
       (ID number) on commit preserve rows) by oracle;
  quit;

  /* Insert records into temp table using PROC APPEND */
proc append base=ora.TEMP(Bulkload=YES) data=SAS_DATASET;
run;

data ora.temp(BULKLOAD=YES BL_DELETE_DATAFILE=YES);

set SAS_DATASET =
select distinct ID from mytable
;

run;



&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 22:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443541#M28664</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T22:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443545#M28666</link>
      <description>&lt;P&gt;If your using SAS EG then if you Load data using Data step then the result will be in output window.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname oralib1 oracle path="(DESCRIPTION=(ADDRESS =
(PROTOCOL = TCP)(HOST =xxxxxxxxxxxx.com)(PORT =1234 ))
(CONNECT_DATA = (SERVICE_NAME=xxxxxx)))"
user=xxxxxxxx pw=xxxxxxxxx connection=global dbmstemp=yes;

/* This Query will only create an empty table */
proc sql;
connect to oracle (user=xxxxxx pw=xxxxxx connection=global);
   execute (create global temporary table TEMP
       (ID number) on commit preserve rows) by oracle;
  quit;
/* You defined your libname as oralib1 not ORA */
 /* Insert records into temp table using Data Step */
data oralib1.temp(BULKLOAD=YES BL_DELETE_DATAFILE=YES);
set SAS_DATASET;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or just run this to confirm the records loaded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select count(*) from oralib1.temp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 22:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443545#M28666</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-07T22:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443546#M28667</link>
      <description>&lt;P&gt;Ok, I think I have it, could you give me a Data Step insert statement I could use for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 23:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443546#M28667</guid>
      <dc:creator>OscarBoots2</dc:creator>
      <dc:date>2018-03-07T23:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use the results of a Pass Through query in another Pass Through query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443553#M28668</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/175636"&gt;@OscarBoots2&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If your remaining problem is to select rows in a large Oracle table based on keys/ids in a small SAS table then consider also the DBMASTER dataset option.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://go.documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=n0jg0sozl17mjyn1woelrrr76266.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://go.documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=n0jg0sozl17mjyn1woelrrr76266.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 23:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-the-results-of-a-Pass-Through-query-in-another-Pass-Through/m-p/443553#M28668</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-07T23:24:03Z</dc:date>
    </item>
  </channel>
</rss>

