user input

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stan Cook

    user input

    How do you write a query which will stop ans wait
    for user input?


    Stan
  • Bill Karwin

    #2
    Re: user input

    Stan Cook wrote:[color=blue]
    > How do you write a query which will stop ans wait for user input?[/color]

    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.

    Comment

    • Stan Cook

      #3
      Re: user input

      That's what I suspected.... Thanks...


      Regards...
      Stan

      Bill Karwin <bill@karwin.co m> wrote:[color=blue]
      >Stan Cook wrote:
      >[color=green]
      >> How do you write a query which will stop ans wait for user input?[/color]
      >
      >
      >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.[/color]

      Comment

      Working...