BookmarkSubscribeRSS Feed

[SAS 활용 FAQ] 오라클에서 SQL을 이용하여 job을 오라클 DB로 전송하면 변수에 값이 세팅된 SQL 문을 오라클에서 볼 수 있습니다. SAS도 가능할까요?

Started ‎10-11-2021 by
Modified ‎10-11-2021 by
Views 563

[상세내용]

Oracle에서 SQL을 이용하여 job을 오라클 DB로 전송하면 변수에 값이 setting된 SQ 문을 Oracle에서 볼 수 있습니다. SAS 에서도 변수 바인딩 방식으로도 값을 전송할 수 있는지 문의드립니다.

 

[답변]

기본적으로 SASbinding되는 변수를 직접 Oracle에 생성할 수 없습니다.

대신, Oracle stored procedure를 이용해서 bind되는 변수를 Oracle에 생성한 후, SAS SQL Pass- through 방식으로 stored procedure를 호출해서 사용하시면 됩니다.

아래는 예제입니다.

 

proc sql;

connect to oracle (user=&usr password=&pw path=&path);

 

/* declare stored procedure here */

 

execute by oracle (

declare max_sas_partition varchar;

begin :max_sas_partition :=&max_sas_partition.; end;

);

 

/* call the declared stored procedure */

create table partitions as

select * from connection to oracle

( select distinct &partition.

from &table.

where &partition. > :max_sas_partition );

disconnect from oracle;

quit;

Version history
Last update:
‎10-11-2021 09:49 PM
Updated by:
Contributors

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

Register now!

Article Labels
Article Tags