kostenloser Webspace werbefrei: lima-city


How to ask MySQL to prompt for values in a query?

lima-cityForumProgrammiersprachenPHP, MySQL & .htaccess

  1. Autor dieses Themas

    dailyxe

    dailyxe hat kostenlosen Webspace.

    I am doing a lot of trial and error with some SQL query in MySQL console e.g.

    select fname, age, address from person where lname = ?;


    I want to get a prompt asking me for the value of lname, so that I can repeat the query with different values easily. The ? works in case the query is from Java code.

    Is it possible in MySQL console, if yes, how?
  2. Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!

    lima-city: Gratis werbefreier Webspace für deine eigene Homepage

  3. buergercorps-haemelerwald

    buergercorps-haemelerwald hat kostenlosen Webspace.

    That's just not possible directly within SQL. You need some kind of a program to do that.
    The question mark is a so called "parameter marker" for SQL where a program could give the SQL to MySQL without directly knowing which exact parameter will be there on execution but the database could already "prepare"/compile the SQL. On execution the program then gives the real parameter which substitutes the question mark.
  4. Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!

    lima-city: Gratis werbefreier Webspace für deine eigene Homepage

Dir gefällt dieses Thema?

Über lima-city

Login zum Webhosting ohne Werbung!