What does an SQL parameter replacer do?
Applications rarely write values into SQL. They send a prepared statement with placeholders, such as WHERE id = ?, and the values travel separately. That is the right way to run queries, but it makes a slow query or an error in the log hard to read: you see ? and a list of values somewhere else. This tool puts the values back into the SQL so you can read the statement as the database saw it, copy it into a console and run it by hand while you investigate.
It recognizes seven placeholder styles: ?, numbered $1, named :name, @name, %s, %(name)s and #{name} from MyBatis. The values can be a JSON array (for positional placeholders), a JSON object (for named ones) or a log line. It understands the lines written by MyBatis, such as Parameters: 5(Integer), abc(String), and the lines written by Hibernate, such as binding parameter [1] as [VARCHAR] - [abc]. In both, the declared type decides how the value is quoted.
The SQL is only scanned, never executed. Text inside string literals, quoted names, comments and dollar-quoted bodies is skipped, so a ? inside a comment is not counted. The result is for reading and debugging. Do not send a statement built this way to a database, bind the values instead. The page repeats this warning next to the output. Everything runs in your browser, so queries and values from your logs stay on your machine.
How to put the values back into the SQL
- Paste the SQL with its placeholders in the first box.
- Paste the values in the second box: a JSON array such as
[5, "abc"], a JSON object such as{"id": 5}, or the parameter line from your log. - Choose the quoting. "Standard" doubles single quotes inside strings. "MySQL" also doubles backslashes.
- Choose how booleans are written:
TRUEandFALSE, or1and0. - Turn on "format the SQL" if you want the statement indented.
- Read the line that says how many placeholders were found and in which style, then copy the SQL.
Examples
A MyBatis log line
SQL:
SELECT * FROM users WHERE id = ? AND status = ? AND created > ?Values:
==> Parameters: 5(Integer), active(String), 2026-11-01 00:00:00.0(Timestamp)Result:
SELECT * FROM users WHERE id = 5 AND status = 'active' AND created > '2026-11-01 00:00:00.0'The Integer type leaves the number bare, while String and Timestamp are quoted.
Named placeholders and an apostrophe
SQL:
UPDATE t SET name = :name, note = :note WHERE id = :idValues:
{"name":"O'Brien","note":null,"id":9}Result:
UPDATE t SET name = 'O''Brien', note = NULL WHERE id = 9The apostrophe is doubled, null becomes NULL, and a name that appears twice in the SQL uses the same value both times.
Numbered placeholders, strings and comments
Numbered placeholders may repeat and come in any order:
SELECT * FROM t WHERE a = $1 AND b = $2 AND c = $1With [7,"x"] the result is:
SELECT * FROM t WHERE a = 7 AND b = 'x' AND c = 7The example that comes with the tool has a question mark inside a comment. It is left alone:
SELECT o.id, o.total, c.name
FROM orders o
JOIN customers c ON c.id = o.customer_id
WHERE o.status = 'paid' AND o.total > 99.9 AND c.country IN ('BR', 'PT')
AND o.created_at >= '2026-11-01 00:00:00' -- it's a "comment" with ? inside
ORDER BY o.created_at DESC
LIMIT 20The values were ["paid", 99.9, "BR", "PT", "2026-11-01 00:00:00", 20]. Six placeholders, six values.
When the count does not match
SELECT ?, ? with [1] stops with the message that the SQL has 2 placeholders but 1 value was given. SELECT :a, :b with {"a":1} says there is no value for b. A statement with no placeholder at all says so too.
Common mistakes
- Running the result against a production database. The output is a reading aid. Literals built by text can be wrong for your driver and open the door to injection. Bind parameters instead.
- Giving the values in the wrong order. For
?and%sthe order of the values is the order of the placeholders. The count is checked, the order is not. - Mixing styles. A statement that uses
:nameexpects a JSON object. A JSON array for a named statement, or an object for?, will not match. - Choosing the wrong quoting. In MySQL a backslash inside a string is an escape character. If your text has backslashes, select the "MySQL" quoting.
- Reading a log line by eye. In a MyBatis line the values are separated by commas, but a value may contain a comma itself. The tool uses the type in parentheses to tell where each value ends, so
a, b(String)is one value,'a, b'. Check the count it reports against your statement. - Expecting a list in
IN (?)to be wrapped twice. A list value written inIN (?)becomesIN (1, 2), with no extra parentheses.
Frequently asked questions
Is my query sent anywhere?
No. The SQL and the values are processed in your browser and never uploaded. Still, avoid sharing logs that hold personal data.
Does the tool check that the SQL is valid?
No. It only finds placeholders and writes literals. It will happily replace values in a statement that your database would reject. To tidy the text, use SQL prettify.
How do I write a value with quotes or backslashes in JSON?
Follow the JSON rules, escaping " and \. If you need to escape a string for another context, the string escape tool can help.
Can it handle Postgres $1 repeated several times?
Yes. Each $n is replaced with the n-th value, in any order and as many times as it appears.