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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ask for a variable only once.

Status
Not open for further replies.

nuct

Programmer
Sep 5, 2001
103
Hi, How do I make it so that my query askes for value of a variable only once. E.g.

Select name, no
From students
Where no in ('&number','&number' -1)

... or something along those lines

At the moment it asks for &number twice, i want it so i only get asked once each time it is run.

Thanks,

Simon H.
 
Try This

Select name, no
From students
Where no in ('&&number','&&number' -1)

Notice there are two '&' prefixing the variable
 
Yeah this is good, but the only problem is that when i run the query for a second time it doesn't give me any prompts at all, any ideas.

Thanks,

Simon.
 
Ok, put this line at the end of the script:

Select name, no
From students
Where no in ('&&number','&&number' -1)
/
undefine number
 
You the man, thanks.

I'll try this tomorrow.

Simon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top