k2v-academy / K2View-Academy

Other
0 stars 0 forks source link

Execute Oracle SQL query containing @ from Broadway or Java #1085

Closed AFOYQqhZ55j0hwYnWQTrk6rnwfNONSEeP6uheHC closed 2 months ago

AFOYQqhZ55j0hwYnWQTrk6rnwfNONSEeP6uheHC commented 2 months ago

I'm trying to execute an Oracel SQL statement which contains @...@ substring. It seems that Fabric is trying to parse this part as a Global, and it is not possible to execute the command.

Running the command directly in Oracle SQL console is executed with no issue:

copy from BANK_SOURCE/BANK_SOURCE@82.76.7.229:1521/XE to BANK_TARGET/BANK_TARGET@localhost:1521/XE create table_name using select * from BANK_SOURCE.ACCOUNT

F78aPg0zjWnRKWkYrBd6lShvmAYl8doniMtEnFN commented 2 months ago

@dotants as far as I know, copy is not a valid SQL command in Oracle. BTW, you are getting an invalid statement error from Oracle (ORA-00900). After some research I found this in Stack Overflow. So, if this command is part of sqlplus, then you cannot use DbCommand actor for that.

tZajFGR0CidT8AVERBHw8puD36HY6oWViykmIIb commented 2 months ago

The SQL query you provided is not valid as it combines SQL DML (Data Manipulation Language) and DDL (Data Definition Language) operations with database-specific syntax that doesn't fully conform to SQL standards. SQL does not have a standardized "copy" command like what is suggested here. Instead, you might need to use specific tools or utilities provided by the database management system (DBMS) or a series of SQL statements to achieve the desired action. To copy data from one database to another (assuming both are Oracle databases):

  1. Create the Table in the Destination Database
  2. Insert Data into the Target Table