Skip to content

[Bug]: Oracle plugin - removeSemicolonFromQuery strips semicolons inside string literals, corrupting query data #42267

Description

@Chinmay0608

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

  1. Connect an Oracle datasource in Appsmith.
  2. Create a query using prepared statement mode with a static string literal containing a semicolon:
    INSERT INTO logs (message) VALUES ('Error; check connection')
  3. Execute the query.
  4. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions