Need help to write a function in shell scripting to execute sql files

Hi,

I am new to shell scripting and i need to write a automation script to execute sql files. I need to check the table if it is there in system tables and need to write a function to call the .sql files.

For ex. I have a.sql,b.sql,c.sql files, where the sql file contains DELETE and INSERT queries.

I am using Netezza as database.

Thanks in advance.

Cheers,
Samah

You have a couple of choices to make first. Do you want to fire these in as separate SQL calls or in one SQL session?

For the separate calls (and assuming oracle) you would do something with a sequence of sqlplus commands, such as:-

sqlplus / @1.sql
sqlplus / @2.sql
sqlplus / @3.sql

For one call, you would be better with a call like this:-

sqlplus / <<EOSQL
1.sql
2.sql
3.sql
EOSQL

Do either of these get you started?

Robin