Connecting Tech Pros Worldwide Forums | Help | Site Map

Urgent Help Needed

Member
 
Join Date: Dec 2007
Posts: 35
#1: Mar 28 '08
Can somebody please help me resolve this?

I have a batch file that copies various sql file into a temp folder. Then run the sql file from the temp location. However, I have to type exit at the sql prompt when on file is done for it move to the next file. I don't what to hard code exit in the sql script, how do I go about this? Also I want to spool each sql file but don't want to hard code it as well.
Please help as I dire need and my project is behind schedule.

Thanks


[code]
copy c:\text1.sql c:\temp
copy c:\text2.sql c\temp
copy c:\text3.sql c:\tem

sqlplusw user/admin@mtestdb @c:\temp\text1.sql
sqlplusw user/admin@mtestdb @c:\temp\text2.sql
sqlplusw user/admin@mtestdb @c:\temp\text3.sql

[\code]

--------------------------------------------------------------------------------

Member
 
Join Date: Dec 2007
Posts: 35
#2: Mar 28 '08

re: Urgent Help Needed


Can somebody please help me resolve this?

I have a batch file that copies various sql file into a temp folder. Then run the sql file from the temp location. However, I have to type exit at the sql prompt when on file is done for it move to the next file. I don't what to hard code exit in the sql script, how do I go about this? Also I want to spool each sql file but don't want to hard code it as well.
Please help as I dire need and my project is behind schedule.

Thanks


Expand|Select|Wrap|Line Numbers
  1. copy c:\text1.sql  c:\temp
  2. copy c:\text2.sql  c\temp
  3. copy c:\text3.sql  c:\tem
  4.  
  5. sqlplusw user/admin@mtestdb  @c:\temp\text1.sql
  6. sqlplusw user/admin@mtestdb  @c:\temp\text2.sql
  7. sqlplusw user/admin@mtestdb  @c:\temp\text3.sql
  8.  
  9.  
--------------------------------------------------------------------------------
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#3: Mar 29 '08

re: Urgent Help Needed


Quote:

Originally Posted by kwartz

Can somebody please help me resolve this?

I have a batch file that copies various sql file into a temp folder. Then run the sql file from the temp location. However, I have to type exit at the sql prompt when on file is done for it move to the next file. I don't what to hard code exit in the sql script, how do I go about this? Also I want to spool each sql file but don't want to hard code it as well.
Please help as I dire need and my project is behind schedule.

Thanks


Expand|Select|Wrap|Line Numbers
  1. copy c:\text1.sql  c:\temp
  2. copy c:\text2.sql  c\temp
  3. copy c:\text3.sql  c:\tem
  4.  
  5. sqlplusw user/admin@mtestdb  @c:\temp\text1.sql
  6. sqlplusw user/admin@mtestdb  @c:\temp\text2.sql
  7. sqlplusw user/admin@mtestdb  @c:\temp\text3.sql
  8.  
  9.  
--------------------------------------------------------------------------------

You will need to use either EXIT or QUIT at the end of each *.sql files. Else the file will not exit after executing the source code in that particular file. Try giving a "/" if you do not want to use exit or quit keyword and using a command EXIT at the END OF FILE is not said as HARD CODING.

Coming to your second requirement, I am not clear with your requirement. You do not want to hardcode the file name to which you want to SPOOL the DATA or you do not want to use SPOOL command in the sql files?
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#4: Mar 29 '08

re: Urgent Help Needed


Duplicate Threads Merged for better management of the forum

MODERATOR
Member
 
Join Date: Dec 2007
Posts: 35
#5: Mar 31 '08

re: Urgent Help Needed


Quote:

Originally Posted by amitpatel66

You will need to use either EXIT or QUIT at the end of each *.sql files. Else the file will not exit after executing the source code in that particular file. Try giving a "/" if you do not want to use exit or quit keyword and using a command EXIT at the END OF FILE is not said as HARD CODING.

Coming to your second requirement, I am not clear with your requirement. You do not want to hardcode the file name to which you want to SPOOL the DATA or you do not want to use SPOOL command in the sql files?


I want to spool the the sql file as the DOS command prompt or in the batch fill.
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#6: Mar 31 '08

re: Urgent Help Needed


This is what you are looking at:

Expand|Select|Wrap|Line Numbers
  1.  
  2. CMD> SQLPLUS uid/pwd@dbname
  3. SQL> SPOOL d:/a.txt
  4. SQL> select * from emp;
  5. SQL> SPOOL OFF;
  6. SQL> EXIT;
  7.  
  8.  
Reply