<?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: Insert into different database from oracle server through SQL pass through in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/822420#M34990</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139803"&gt;@R_Chung&lt;/a&gt;&amp;nbsp;As for your concern with credential: Look-up what authentication domains could do for you.&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jul 2022 07:55:23 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2022-07-09T07:55:23Z</dc:date>
    <item>
      <title>Insert into different database from oracle server through SQL pass through</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/821466#M34920</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to insert something to different oracle database from my SAS dataset.&lt;/P&gt;&lt;P&gt;As usual, the syntax of&amp;nbsp;selecting table from other database is&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;select * from otherowner.tablename;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Let say I have a SAS dataset aaa.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql noprint;    
		connect to oracle 
			(user=xxx password=xxx path=xxx);    
			execute (insert into otherowner.tablename select * from work.aaa) by oracle;
			disconnect from oracle; 
quit;

&lt;/PRE&gt;&lt;P&gt;It seems that SAS seek "&lt;STRONG&gt;otherowner&lt;/STRONG&gt;" as libname to operate the above statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Meanwhile, I have tried to add &lt;STRONG&gt;preserve_comments&lt;/STRONG&gt;, i.e,&lt;/P&gt;&lt;PRE&gt;proc sql noprint; 
        connect to oracle (user=xxx password=xxx path=xxx preserve_comments=YES); 
        execute (insert into /*otherowner.tablename */ select * from work.aaa) by oracle; 
        disconnect from oracle; 
quit; &lt;/PRE&gt;&lt;P&gt;However, this is also not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could any expert advise how to implement what I want to execute. Many thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jul 2022 09:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/821466#M34920</guid>
      <dc:creator>R_Chung</dc:creator>
      <dc:date>2022-07-04T09:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into different database from oracle server through SQL pass through</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/821484#M34922</link>
      <description>&lt;P&gt;You cannot use code pushed to Oracle to access data in SAS datasets (the oracle code will have no idea what WORK.SAS is).&lt;/P&gt;
&lt;P&gt;You need to run SAS code to push SAS datasets into Oracle.&lt;/P&gt;
&lt;P&gt;Easiest thing it is make a libref that points to ORACLE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname myora oracle ..... ;
proc append base=myora.tablename data=work.sas;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If for some reason you need to insert into a table that is in a different Oracle schema than the one you connect to the libref to try using the SCHEMA= dataset option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname myora oracle ..... ;
proc append base=myora.tablename(schema='otherowner') data=work.sas;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jul 2022 15:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/821484#M34922</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-04T15:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into different database from oracle server through SQL pass through</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/821521#M34926</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;For option one, I usually using this for inserting data into table.&lt;/P&gt;&lt;P&gt;However, if I need to insert into other database I need to especially specify other username in my libname statement.&lt;/P&gt;&lt;PRE&gt;libname myora oracle ..... user=otheruser pw="";other user password="";&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This may lead to a concern that everyone will know the password.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the second option but there is still an error.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ERROR: The ORACLE table &amp;lt;table_name&amp;gt; has been opened for OUTPUT. This table already exists, &lt;BR /&gt;or there is a name conflict with an existing object. This table will not be replaced. This engine does not support the REPLACE option.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have read the support post: &lt;A href="https://support.sas.com/kb/32/461.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/32/461.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But they suggest to omit the &lt;STRONG&gt;schema=&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you advise again?&lt;/P&gt;&lt;P&gt;I think the second option is the closest solution for my case.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 02:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/821521#M34926</guid>
      <dc:creator>R_Chung</dc:creator>
      <dc:date>2022-07-05T02:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into different database from oracle server through SQL pass through</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/821779#M34947</link>
      <description>&lt;P&gt;Actually, specifying schema is already enough for your case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If adding schema in your proc append is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try adding it in your library statement.&lt;/P&gt;&lt;PRE&gt;libname myora oracle &amp;lt;your connection string&amp;gt; schema=otherowner ;&lt;/PRE&gt;&lt;P&gt;See if this works.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 06:03:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/821779#M34947</guid>
      <dc:creator>ricric</dc:creator>
      <dc:date>2022-07-06T06:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into different database from oracle server through SQL pass through</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/822420#M34990</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139803"&gt;@R_Chung&lt;/a&gt;&amp;nbsp;As for your concern with credential: Look-up what authentication domains could do for you.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2022 07:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Insert-into-different-database-from-oracle-server-through-SQL/m-p/822420#M34990</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-07-09T07:55:23Z</dc:date>
    </item>
  </channel>
</rss>

