BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JeroenPotgieter
Calcite | Level 5

Hi all,

 

In DI Studio I want to join two oracle table with pass-through facility. In the standard execution 'join' tranformation, SAS DI pefroms the following steps :

1. It creates the table in Oracle

2.  And with an insert it loads the data into the table.

All this with bad performance.

 

Is it possible with a standard 'join' transformation to let DI Studio make only a 'Create Table As'  SQL? Or is an option available, that I'm not aware of, in SAS DI that will create a 'CTAS' sql query? 

 

Current Situation:

 

data Oracle-libname.[tablename]

(dbnull = (
columnname1 = NO
columnname2 = NO
columnname3 = NO));
attrib columnname1 length = $32
format = $32.
informat = $32.
label = 'columnname1';
attrib columnname2 length = $32
format = $32.
informat = $32.
label = columnname2';
attrib columnname3 length = $32
format = $32.
informat = $32.
label = 'columnname3';
call missing(of _all_);
stop;
run;

 

proc sql;
connect to ORACLE
(
[Connection string]
);
execute
(
insert into oracle-location.oracle-table
select
A.columnname1,
A.columnname2,
A..columnname3
from
oracle-location.oracle-tablename1 A inner join
oracle-location.oracle-tablename2 B
on
(
A..columnname1 = B.columnname1
and B.columnname2 = 1
)

) by ORACLE;

%rcSet(&sqlrc);

 

disconnect from ORACLE;
quit;

 

 

Preferred Sitation:

 

proc sql;
connect to ORACLE
(
[Connection string]
);
execute
(
create table oracle-location.oracle-table as (
 select
A.columnname1,
A.columnname2,
A..columnname3
from
oracle-location.oracle-tablename1 A inner join
oracle-location.oracle-tablename2 B
on
(
A..columnname1 = B.columnname1
and B.columnname2 = 1
))

) by ORACLE;

%rcSet(&sqlrc);

 

disconnect from ORACLE;
quit;

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

I don't believe OOT DIS transformations can generate your desired syntax. 

You can always go for a user written code transformation or if you want something reusable for a custom transformation. And to keep things still to a certain degree metadata driven you then can use the DIS generated macro variables in your code.

 

If going for user written code: Make sure you design and write this code in a way so it's re-runnable (like: drop table if it already exists).

View solution in original post

2 REPLIES 2
JeroenPotgieter
Calcite | Level 5

Anyone?? Any help would be appreciated..

 

Patrick
Opal | Level 21

I don't believe OOT DIS transformations can generate your desired syntax. 

You can always go for a user written code transformation or if you want something reusable for a custom transformation. And to keep things still to a certain degree metadata driven you then can use the DIS generated macro variables in your code.

 

If going for user written code: Make sure you design and write this code in a way so it's re-runnable (like: drop table if it already exists).

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 921 views
  • 1 like
  • 2 in conversation