Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

UNIX SQL script delete

Posted on 2007-11-29
5
Medium Priority
?
1,009 Views
Last Modified: 2013-12-18
I have a UNIX shell script that calls an sql file.  In the sql file I have:

delete from tableA where fw_insert_date < sysdate-30
delete from   tableB  where insert_date < sysdate-30
delete from   tableC  where insert_date < sysdate-30
commit

The shell script calls the SQL script but nothing happens. What do I need to add to the SQL file to make this work?
0
Comment
Question by:jjc_mn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 14

Accepted Solution

by:
GGuzdziol earned 2000 total points
ID: 20376395
Semicolon after each individual statement? If this is not the case - please show script's and sql file's actual code...
delete from tableA where fw_insert_date < sysdate-30;
delete from tableB where insert_date < sysdate-30;
delete from tableC where insert_date < sysdate-30;
commit;

Open in new window

0
 
LVL 11

Expert Comment

by:mohammadzahid
ID: 20376479
Just to be on the safe side if your database is production...

I recommed that you take out commit from your script and add SQL statement to give you row count before and after the delete with output (spool file). Verify deleted rows and then issue commit outside of the script.

0
 
LVL 32

Expert Comment

by:awking00
ID: 20377141
What does the shell script look like?
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 20380393
does the sql statements work if you run them in the sql> prompt directly.

If yes, then may be missing ; is the only thing which i can think of.

If no, then first you need to check why there are not working ( resolve the errors if you are getting any ).

Thanks
0
 

Author Closing Comment

by:jjc_mn
ID: 31411760
The semi-colons were what I was missing. Thanks all.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question