DATA Step, Macro, Functions and more

Deleting Oracle Tables from SAS- Most Efficient Method

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 83
Accepted Solution

Deleting Oracle Tables from SAS- Most Efficient Method

Hi ,

Need some advice on which type of methods can be used to efficiently and quickly delete a couple million rows in Oracle from SAS.

 

Some errors see during the course of action below.

Error received on SAS - “ERROR: Update/delete failed. The observation may have been changed or deleted since the time it was read. ORACLE execute error:

       ORA-08177: can't serialize access for this transaction.

ERROR: ROLLBACK issued due to errors for data set XYZ

NOTE: Deletes were rolled back by the DBMS software.”


Accepted Solutions
Solution
‎01-27-2016 11:12 AM
Contributor tlk
Contributor
Posts: 54

Re: Deleting Oracle Tables from SAS- Most Efficient Method

[ Edited ]

Hi,

 

You can use a Proc SQL:

 

Proc sql;

connect to oracle(user=yourusername pass=yourpass path=bd);

execute (truncate table yourtable)

by oracle;

quit;

 

Laurent

View solution in original post


All Replies
Solution
‎01-27-2016 11:12 AM
Contributor tlk
Contributor
Posts: 54

Re: Deleting Oracle Tables from SAS- Most Efficient Method

[ Edited ]

Hi,

 

You can use a Proc SQL:

 

Proc sql;

connect to oracle(user=yourusername pass=yourpass path=bd);

execute (truncate table yourtable)

by oracle;

quit;

 

Laurent

Super User
Posts: 5,429

Re: Deleting Oracle Tables from SAS- Most Efficient Method

Do you want to delete tables, or rows in tables?

If you have the appropriate rights, drop table would work, can't see if you can optimize that.

If you want to delete rows effectively, that's more of an Oracle DBA question. Once you know the Oracle syntax, you might want to discover of you can achieve that using implicit SQL pass-thru from SAS.

Data never sleeps
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 1013 views
  • 1 like
  • 3 in conversation