<?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 PASS-THROUGH to Oracle, use SAS MACRO variable as bind variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883354#M349010</link>
    <description>&lt;P&gt;So, when querying Oracle from SAS using proc sql, it's not possible to hide values that are part of the SQL statement?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jul 2023 22:09:53 GMT</pubDate>
    <dc:creator>PharmlyDoc</dc:creator>
    <dc:date>2023-07-03T22:09:53Z</dc:date>
    <item>
      <title>PROC SQL PASS-THROUGH to Oracle, use SAS MACRO variable as bind variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883351#M349008</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This question is similar to mine:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Using-bind-variables-in-PROC-SQL-query-to-Oracle-database-server/m-p/111749" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Procedures/Using-bind-variables-in-PROC-SQL-query-to-Oracle-database-server/m-p/111749&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am querying an Oracle database from SAS, and I am unable to create temporary tables within the Oracle database.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I find proc sql explicit pass-through to be the fastest method for querying the database.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I want to do is define a macro variable within SAS called PatID, and then passthrough the value for PatID to a bind variable called pat_id_var within Oracle. The following code returns "ERROR: ORACLE execute error: ORA-01008: not all variables bound."&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET PatID='123456789';
proc sql;
CONNECT TO ORACLE(AuthDomain='OracleAuth' PATH= );
execute (DECLARE pat_id_var varchar2(18);
begin :pat_id_var := &amp;amp;PatID. ;
end;
) by ORACLE;
create table work.WANT as
select *&amp;nbsp;
from connection to oracle (
select PatientID
from oradb.PATIENTS&amp;nbsp;
where PatientID = :pat_id_var
);
disconnect from ORACLE;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My goal is to hide the true value of PatID in both SAS log and Oracle.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following code does not hide the PatID value when I view the sql statement in Oracle:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET PatID='123456789';
proc sql;
CONNECT TO ORACLE(AuthDomain='OracleAuth' PATH= );

create table work.WANT as
select *&amp;nbsp;
from connection to oracle (
select PatientID
from oradb.PATIENTS&amp;nbsp;
where PatientID = &amp;amp;PatID.
);
disconnect from ORACLE;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks for any insight!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 21:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883351#M349008</guid>
      <dc:creator>PharmlyDoc</dc:creator>
      <dc:date>2023-07-03T21:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL PASS-THROUGH to Oracle, use SAS MACRO variable as bind variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883352#M349009</link>
      <description>&lt;P&gt;You probably cannot do what you are trying. You have to either run a command (EXECUTE) or run a query (FROM CONNECTION TO) in PROC SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And even if you it did work it would probably still show the patid in the SQL logs.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 21:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883352#M349009</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-07-03T21:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL PASS-THROUGH to Oracle, use SAS MACRO variable as bind variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883354#M349010</link>
      <description>&lt;P&gt;So, when querying Oracle from SAS using proc sql, it's not possible to hide values that are part of the SQL statement?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 22:09:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883354#M349010</guid>
      <dc:creator>PharmlyDoc</dc:creator>
      <dc:date>2023-07-03T22:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL PASS-THROUGH to Oracle, use SAS MACRO variable as bind variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883358#M349012</link>
      <description>&lt;P&gt;What is the business need to hide PATID, given it is in the SAS table you are creating and the Oracle table you are querying. If this column is that sensitive it should be encrypted in Oracle and then you would query on the encrypted value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 21:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-PASS-THROUGH-to-Oracle-use-SAS-MACRO-variable-as-bind/m-p/883358#M349012</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-07-03T21:32:05Z</dc:date>
    </item>
  </channel>
</rss>

