running .sh, .sql .etc how to?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers running .sh, .sql .etc how to?
# 1  
Old 02-12-2004
running .sh, .sql .etc how to?

hi all

yes, I am a beginner in Unix,-sun solorais--V8...

what is the command to run files....

single and batch jobs....any help would be great...

Cheers

ps...i know running files in Sqlplus on Unix prompt, I can use the @' sign...but how does this work..

Cheers
E
# 2  
Old 02-12-2004
Do you mean simply running a script at the prompt? If you have a file called "myscript" in /usr/your/directory, you can type any of these:
Code:
1. > cd /usr/your/directory
   > myscript

2. > cd /usr/your/directory
   > ./myscript

3. > /usr/your/directory/myscript

# 3  
Old 02-12-2004
The '@' sign as you described it is peculiar to Oracle. Here is some more information. In addition,
Click Here for a SQL/SQL*PLUS tutorial site.
Code:
@ 
PURPOSE: 

To run the specified command file. The @ command functions similarly to START. 

SYNTAX: 


	@ file_name[.ext] [arg...]

Where: 


file_name[.ext] : is the command file you wish to run. If you omit ext, SQL*Plus assumes
the default command-file extension (usually SQL). To change the default extension, use
the SUFFIX clause of the SET command. Use @file_name or @ file_name; the space is optional.
Case may be significant in some operating environments. 

arg... : represent data items you wish to pass to parameters in the command file. If you
enter one or more arguments, SQL*Plus substitutes the values into the parameters (&1, &2,
and so forth) in the command file. The first argument replaces each occurrence of &1, the
second replaces each occurrence of &2, and so forth.

The @ command DEFINEs the parameters with the values of the arguments; if you run the
command file again in this session, you can enter new arguments or omit the arguments to
use the current values. 

Example: 
To run a command file named PRINTRPT.SQL, enter: 

SQL>  @PRINTRPT 
To run the command file WKRPT with the extension QRY, enter: 
SQL>   @WKRPT.QRY

just formatted the text so it wasn't scrolling off the right side Smilie

Last edited by oombera; 02-12-2004 at 10:05 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies

2. Shell Programming and Scripting

Issue with quotes when running SQL command from within su -c

RHEL 6.2/Bash shell root user will be executing the below script. It switches to oracle user logs in using sqlplus and tries to run the below UPDATE statement. All the commands after su -c are enclosed in a single quote delimited by semicolon. The execution has failed because the quotes... (3 Replies)
Discussion started by: omega3
3 Replies

3. UNIX for Dummies Questions & Answers

Running a SQL Query from UNIX

Hi, Could you please help me on this. I have bulk of queries written in text file. I want to use those queries and want to execute from UNIX. I don't want to run this file as a sql file as this file will change every week. I want to run it in my environment as bulk sql statement from text... (1 Reply)
Discussion started by: abhii
1 Replies

4. Shell Programming and Scripting

Running multiple sql files in unix

In c:/zaheer/123-456/sql/ folder i have below 7 sql files. cv_abc_a.sql cv_abc_b.sql cv_abc_c.sql vtemp_d.sql vtemp_e.sql cv_abc_f.sql Exviews.sql In Exviews.sql file i have mentioned all cv and vtemp files to run like start ${SQLDIR}/cv_abc_a.sql start ${SQLDIR}/cv_abc_b.sql... (1 Reply)
Discussion started by: Zaheer.mic
1 Replies

5. Shell Programming and Scripting

Running Sql scripts accross db2

Hi, I would be really thankful, if anyone could help me out with this,since i am very new to this shell scripting. I have 6 sql scripts that i am trying to run in unix across db2. i want the scripts to be executed as follows, script_1 should be executed first. Then... (4 Replies)
Discussion started by: jnimz
4 Replies

6. Shell Programming and Scripting

Confirmation needed while running the sql's

Hi, I need confirmation whether the same functionality exists when running the sql's. For ex. let us consider there exists a sql file with name june.When running in sql mode does: @june.sql and start june.sql does the same functionality. Someone help me. Thanks Ashok. (1 Reply)
Discussion started by: Ashok_oct22
1 Replies

7. UNIX for Dummies Questions & Answers

running sql script and email it

Hi All I have this sql script lets say abc.sql How to run this script with this following conditions : 1 - The script will run everyday and mailx to me by using crontab 2 - The output of this script will be saved to someplace and attach with mailx OR can be display as email text and then send... (3 Replies)
Discussion started by: adzuanamir
3 Replies

8. UNIX for Dummies Questions & Answers

Running PL/SQL procedure via unix

All, I have a 10g PL/SQL procedure that needs to be run via a unix script. How could such a script be developed. Thanks Aditya. (1 Reply)
Discussion started by: kingofprussia
1 Replies

9. UNIX for Dummies Questions & Answers

problems running a sql loader script

Hi Folks, I have created a number of unix scripts that i can run from the scheduler on a server-side application that we use (Chordiant Marketing Director). All scripts are working except one. This last script is a user load script which first truncates a table and then loads it using a flat... (2 Replies)
Discussion started by: jibbadiah
2 Replies

10. UNIX for Dummies Questions & Answers

running sql in crontab

Hi, i have a scripts that update an SQL DATABASE using sqlplus command. when i run it in a interactive mode its ok but when try to run it using the crontab i get an a messege : "Must be attached to terminal for 'am I' option" (there is no "who am i" command in the script) and the DB... (4 Replies)
Discussion started by: dorilevy
4 Replies
Login or Register to Ask a Question