By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

user input

P: n/a
How do you write a query which will stop ans wait
for user input?
Stan
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Stan Cook wrote:
How do you write a query which will stop ans wait for user input?


If you mean something like the Oracle "&" prompt for user input in
SQL*Plus, I don't think the MySQL command-line interface has that feature.

You need to do this in some kind of application code. Prompt the user
for input using your favorite programming language, use their input
while constructing a SQL query, then execute that query.

Example in Bourne shell:

:
echo -n "Enter a value: "
read value
mysql mydatabase -e "select * from mytable where myfield = '$value';'

(nb: example not tested)

Regards,
Bill K.
Jul 23 '05 #2

P: n/a
That's what I suspected.... Thanks...
Regards...
Stan

Bill Karwin <bi**@karwin.com> wrote:
Stan Cook wrote:
How do you write a query which will stop ans wait for user input?

If you mean something like the Oracle "&" prompt for user input in SQL*Plus, I don't think the MySQL command-line interface has that feature.

You need to do this in some kind of application code. Prompt the user for input using your favorite programming language, use their input while constructing a SQL query, then execute that query.

Example in Bourne shell:

:
echo -n "Enter a value: "
read value
mysql mydatabase -e "select * from mytable where myfield = '$value';'

(nb: example not tested)

Regards,
Bill K.


Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.