BookmarkSubscribeRSS Feed
PhilipH
Quartz | Level 8

Hello,

we got a bit of an unstable Oracle DB environment and I wonder if there is a way to check if table A & B is available

before I run my proc sql to select from them.

Bye

3 REPLIES 3
Kalind_Patel
Lapis Lazuli | Level 10

Why not you create a temporary odbc library for your oracle DB in SAS EG or Base SAS, and check that two tables are presence or not in that database.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

You could select from dictionaries.tables as pass through, this would return what tables are available, something like:

proc sql;
  connect to oracle (path=...);
  create table O_DATA as
  select * from connection to oracle (
    select * from DICTIONARY.TABLES where NAME="<yourtable>");
  disconnect from oracle;
quit;

data _null_;
  set o_data;
  call execute('proc sql; ... quit;');
run;

So pull the metadata from oracle where the name is your table (note you will need to update specifics), then in a datastep generate the proc sql to extract data only if a row for your dataset is returned, i.e. the above will return no obs if your table doesn't exist, hence will not generate the call execute.

boemskats
Lapis Lazuli | Level 10

This explicit passthrough is a good idea. You'll need to query from all_tables - Oracle's idea of dictionary.tables.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 713 views
  • 0 likes
  • 4 in conversation