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

Greetings,

I'm on SAS 9.4 and trying to use OR_IDENTITY_COLS to Use Oracle Sequence when loading a table. The documentation @ https://go.documentation.sas.com/?docsetId=acreldb&docsetTarget=n17merknv57i0un1vhszwcwbzab9.htm&doc... is vague.

Has anyone used this. If so, can you provide an example

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
tborange
Fluorite | Level 6

SAS Tech Support provided the answer:

Note: That if you're using another Oracle schema's sequence, you need to add it as follows.

'{Schema Name Here}.TEST_SEQ.NEXTVAL' 

Here is an example:

 

DATA TEST_IMPORT;

INPUT LOC_NM $;

DATALINES;

EIN

BVN

TST

RUN;

 

*NWDWLIB is a macro variable with the string of connecting to one of our Oracle DBs;

LIBNAME &NWDWLIB;

PROC SQL;

INSERT INTO NWDWLIB.TEST_LOC

(OR_IDENTITY_COLS=(DW_TEST_LOC_ID='TEST_SEQ.NEXTVAL'),DW_TEST_LOC_ID,LOC_NM)

SELECT  ., LOC_NM

FROM WORK.TEST_IMPORT;

QUIT;

 

LIBNAME NWDWLIB CLEAR;

View solution in original post

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

One for tech support I reckon. I couldn't find a syntax that worked as intended.

tborange
Fluorite | Level 6

HI Chris,

Thanks for your opinion.

I was able to get it to work syntactically. However, the sequence # didn't flow through to the Oracle table.

I'll contact my company's tech support rep and update this thread accodringly.

Thanks again.

Troy

tborange
Fluorite | Level 6

SAS Tech Support provided the answer:

Note: That if you're using another Oracle schema's sequence, you need to add it as follows.

'{Schema Name Here}.TEST_SEQ.NEXTVAL' 

Here is an example:

 

DATA TEST_IMPORT;

INPUT LOC_NM $;

DATALINES;

EIN

BVN

TST

RUN;

 

*NWDWLIB is a macro variable with the string of connecting to one of our Oracle DBs;

LIBNAME &NWDWLIB;

PROC SQL;

INSERT INTO NWDWLIB.TEST_LOC

(OR_IDENTITY_COLS=(DW_TEST_LOC_ID='TEST_SEQ.NEXTVAL'),DW_TEST_LOC_ID,LOC_NM)

SELECT  ., LOC_NM

FROM WORK.TEST_IMPORT;

QUIT;

 

LIBNAME NWDWLIB CLEAR;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 837 views
  • 0 likes
  • 2 in conversation