[Bug]: Oracle plugin - removeSemicolonFromQuery strips semicolons inside string literals, corrupting query data
Is there an existing issue for this?
- I have searched the existing issues
Description
The Oracle plugin's removeSemicolonFromQuery method in OracleExecuteUtils.java uses a naive query.replaceAll(";", "") to strip semicolons before executing non-PL/SQL prepared statements (Oracle JDBC rejects trailing semicolons).
However, this blindly removes every semicolon in the SQL — including those inside string literals — which silently corrupts query data.
Steps To Reproduce
- Connect an Oracle datasource in Appsmith.
- Create a query using prepared statement mode with a static string literal containing a semicolon:
INSERT INTO logs (message) VALUES ('Error; check connection') - Execute the query.
- Observe the value stored in the database is
'Error check connection'— the semicolon was silently stripped.
Root Cause
OracleExecuteUtils.java lines 97–99:
public static String removeSemicolonFromQuery(String query) {
return query.replaceAll(";", "");
}Called from OraclePlugin.java lines 187–188 (prepared statement path only):
if (!isPLSQL(updatedQuery)) {
updatedQuery = removeSemicolonFromQuery(updatedQuery);
}Affected Queries (Examples)
-- String literal with semicolon — value silently corrupted
INSERT INTO logs (message) VALUES ('Error; check connection')
-- Stored as: 'Error check connection'
-- WHERE clause with semicolon in string — wrong rows matched
SELECT * FROM t WHERE category = 'type; A'
-- Executes as: SELECT * FROM t WHERE category = 'type A'
-- Trailing semicolon (the intended case — should be removed)
SELECT * FROM employees;
-- Should become: SELECT * FROM employees ✓Expected Behavior
Only trailing semicolons that appear outside of string literals and comments should be stripped. Semicolons inside string literals (e.g., 'Error; check') must be preserved.
Public Sample App
No response
Environment
All environments (cloud, self-hosted)
Severity
High (Silent data corruption — no error is shown to the user)
Version
All versions using the Oracle plugin
Source: appsmithorg/appsmith