Skip to content

[BUG] E2002 Error Occurs when using Oracle #202

@farmboy-dev

Description

@farmboy-dev

Bug Description

E2002 Error

gosqlx validate "SELECT * FROM schema.table_name"
❌ SELECT * FROM schema.table_name: parsing failed: Error E2002 at line 0, column 0: expected statement, got .

gosqlx validate "SELECT * FROM table_name"
✅ SELECT * FROM table_name: Valid SQ

test.sql

CREATE OR REPLACE function function_name (
  var1       varchar2)
  return                    varchar2

is
  var2            varchar2(100);

begin
    
  select table_col1
  into var2 
  from table_name
  where table_col2 = var1;
      
  return (var2);

end;
/
gosqlx validate test.sql 
❌ test.sql: parsing failed: Error E2002 at line 0, column 0: expected TABLE, VIEW, MATERIALIZED VIEW, or INDEX after CREATE, got IDENT


Hint: Expected 'TABLE, VIEW, MATERIALIZED VIEW, or INDEX after CREATE' keyword here
Help: https://docs.gosqlx.dev/errors/E2002

configuration

# GoSQLX Configuration
# Source: default configuration

format:
    indent: 2
    uppercase_keywords: true
    max_line_length: 80
    compact: false
validate:
    dialect: oracle
    strict_mode: false
    recursive: false
    pattern: '*.sql'
    security:
        max_file_size: 10485760
output:
    format: auto
    verbose: false
analyze:
    security: true
    performance: true
    complexity: true
    all: false

To Reproduce

Steps to reproduce the behavior:

  1. Code snippet or SQL query used: gosqlx validate "SELECT * FROM schema.table_name"
  2. Expected behavior
  3. Actual behavior
  4. Error message (if any)

Code Example

// Your code here

SQL Query

-- Your SQL query that causes the issue

Expected Behavior

A clear and concise description of what you expected to happen.

Actual Behavior

What actually happened, including any error messages.

Environment

  • OS: [e.g. macOS, Linux, Windows] Linux/amd64
  • Go Version: [e.g. 1.24] 1.24.5
  • GoSQLX Version: [e.g. v1.0.0] v1.6.0

Additional Context

Add any other context about the problem here.

Possible Solution

If you have ideas on how to fix the issue, please describe them here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions