Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie: pormpt for values at run-time

Status
Not open for further replies.

SQLSusie

Technical User
May 9, 2002
2
GB
Hello,

I am a newbie and am pondering over how to solve this problem:

I need to prompt at run-time for different colleges to be put into a query. Unfortunately, I have no idea what keyword to read up on.

Can anybody help?

Thank you for your time, greatly appreciated.

Susie
 
A little more information is needed.

Can you supply operating system and Database. Also whether in a script or a program.
 
The Operating System is Windows NT and the database is Orcale8 (Personal).

Somebody hinted to me that I need to use AND in the query but I am not sure what he meant.

Thank you!
 
SQLSusie,

it sound to me like you need to use a host variabel in a program. Can you supply any further information. Is it to be a script or a program. Do you have the query as you have written it so far or even some pseudo code for the query. We need a bit more information to go on to help you here.
 
One way of doing this is to run an SQL*Plus script. (I'm assuming that Personal Oracle is similar to Oracle Enterprise Edition.)

You should create a file with the sql command(s) that you want to execute. For example

select * from colleges where
college_name = '&college1' or college_name = '&college2'
/

Naturally the exact sql depends on what you want to do. The "&" character indicates a replacement variable that will be input by the user running the query.

To execute the query, go into SQL*Plus and type

@full_path_of_sql_file

The "@" character indicates that the contents of the file are to be executed as though you were typing the same sql in your SQL*Plus session.

Because your script contains replacement variables, you will be prompted to enter them. It will look something like

Enter value for college1:
Enter value for college2:

After you enter values your sql will execute and you will see the results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top