Help using Base SAS procedures

Table constraints missing when creating a data set based on an oracle table

Reply
Super Contributor
Posts: 398

Table constraints missing when creating a data set based on an oracle table

I want to make a local copy of an oracle table. I need all the indexs, constraints, PK, etc..

When I do the following I just get the data without any of the constraints.

data tree_node ;
set ora.tree_node ;
run ;

What is the best way to get the exact table definition as it is within oracle ?

thank you
Trusted Advisor
Posts: 2,113

Re: Table constraints missing when creating a data set based on an oracle table

SAS does not support table constraints, so you can't extract it except as a text file.
Super Contributor
Posts: 398

Re: Table constraints missing when creating a data set based on an oracle table

Doc,
Thank you so much for your response.

So when I try and create a data set based off of an oracle table or a different sas data set that have primary or foreign keys why doesn't those keys come along with the new data set?

Thank you
Trusted Advisor
Posts: 2,113

Re: Table constraints missing when creating a data set based on an oracle table

Jerry,

From the SAS SQL documentation, "The SQL research project at SAS has focused primarily on the expressive power of SQL as a query language. Consequently, some of the database features of SQL have not yet been implemented in PROC SQL."

To understand all the differences (there are lots), you will need to read all about SAS Datasets in the BASE documentation concepts area and the differences between SAS SQL and ANSI SQL.

Doc
Super Contributor
Posts: 398

Re: Table constraints missing when creating a data set based on an oracle table

Doc,

Thank you I will look at the documentation.

I made the mistake of assuming since I was creating a data set based off of another data set that the PK and FK would carry along with it.

Thank You
Contributor
Posts: 63

Re: Table constraints missing when creating a data set based on an oracle table

SAS does support integrity constraints but they do not come along with the data when you create a data set from an Oracle table.  They must be recreated using PROC DATASETS.  Here's a link to Mike Raithel's 2011 SGF paper.  It's a .pdf so just search on 'constraint'.  http://support.sas.com/resources/papers/proceedings11/274-2011.pdf

If the primary key and foreign key physically exist as fields in an Oracle table I don't know of any reason why they wouldn't be in the SAS data set, but there won't be anything other than the variable name to indicate that they are the PK and FK.

Ask a Question
Discussion stats
  • 5 replies
  • 131 views
  • 0 likes
  • 3 in conversation