Hi,
sqlplus "abc/abc@db1" @ test.sql
test.sql
--------
select count(*) from table1;
if the table is present in the DB then i want to continue test.sql script. other wise exit. please suggest.
wants to check whether the table is present or not.
Moderator: DosItHelp
Re: wants to check whether the table is present or not.
Code: Select all
mySQL.EXE test.sql &&goto :continiue ||goto :error
:error
echo.%errorLevel%
exit
:continiue
do something
-
- Expert
- Posts: 976
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: wants to check whether the table is present or not.
awais290 wrote:Hi,
sqlplus "abc/abc@db1" @ test.sql
test.sql
--------
select count(*) from table1;
if the table is present in the DB then i want to continue test.sql script. other wise exit. please suggest.
try something like this.
you may create a script that return 0/1
test_exists.sql:
select count(*) from user_tables where table_name="table1";
and catch output in a for /F %%f in ('sqlplus "abc/abc@db1" @ test_exist.sql') do if "%%f"=="1" sqlplus "abc/abc@db1" @ test.sql
I can not check the output then surely there is something to fix.
einstein1969