Error in loading the file into the table - sql

load DATA LOCAL
infile 'C:\Users\abcdefg.h.ABCINDIA\datafile.csv'
INTO TABLE XXSYMC.invoice_demo
fields terminated BY " " optionally enclosed BY '"'
(invoice_number,org_id,supplier_id);
I get the error as shown below:
ORA-00928: missing SELECT keyword
00928. 00000 - "missing SELECT keyword"
*Cause:
*Action:

SQL Developer is for running SQL statements and PL/SQL code. What you're trying to run is SQL*Loader control file syntax.
They are completely different tools, and you cannot run SQL*Loader commands from SQL Developer. If you want to load that file you can use the SQL*Loader command line.
If the file is available on the database server you could create an external table instead, and copy the data from that into your real table; you could at least do that from SQL Developer, as long as you have the right permissions and can put the file in a server directory that Oracle recognises...

Related

SQL Oracle developer with hive connection - using of temp tables

We are using hive connection with oracle SQL developer tool.
Is it possible to use temporary tables while querying external tables through sql developer tool?
Tried this , But doesn't work
CREATE PRIVATE TEMPORARY TABLE my_temp_table (
id NUMBER,
description VARCHAR2(20)
);
Error :
SQL Error: [Cloudera]HiveJDBCDriver ERROR processing query/statement. Error Code: 40000, SQL state: TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Error while compiling statement: FAILED: ParseException line 1:7 cannot recognize input near 'CREATE' 'PRIVATE' 'TEMPORARY' in ddl statement:28:27, org.apache.hive.service.cli.operation.Operation:toSQLException:Operation.java:335,
You can't use an Oracle Database syntax against a hadoop/HIVE target, even with the Oracle Big Data Connector.
Here are the CREATE TABLE clauses available to you
https://docs.oracle.com/en/bigdata/big-data-sql/4.0/bdsug/bigsqlref.html#GUID-066A4568-9F95-4305-A1A5-7BC3E5DF35AF
Here are examples for querying your external table
https://docs.oracle.com/en/bigdata/big-data-sql/4.0/bdsug/bigsql.html#GUID-0628EC5B-E013-40DF-A025-908019F4E681

Simple Syntax Error in SQLite: "Error near line 1: near "SQLite"

I am having a great deal of trouble with this seemingly simple issue. I can't seem to get .read to work. Here is the code that I have tried:
Any help would be greatly appreciated!
.open test.sql
This opens a Sqlite3 database (Creating a new one if the file doesn't already exist) and attaches it as the main one in the sqlite3 shell session.
.read test.sql
This attempts to read a text file full of SQL statements and execute them one by one.
A sqlite database is not a text file full of SQL statements, hence the syntax errors when you try to treat it as one.
The correct syntax is:
CREATE TABLE t (x int);
or
CREATE TABLE t (x INTEGER);
Read more about the CREATE statement and data types.

psql restore sql dump syntax error

I am trying to import https://www.yelp.com/dataset/documentation/sql into a PostgreSQL instance. It is having problems with accent marks/backtick. Other than doing a character replace, is there any other way to deal with this?
ERROR: syntax error at or near "PaxHeader"
LINE 1: PaxHeader/yelp_db.sql17 uid=998889796
^
ERROR: syntax error at or near "`"
LINE 1: CREATE DATABASE /*!32312 IF NOT EXISTS*/ `yelp_db` /*!40100 ...
^
ERROR: syntax error at or near "USE"
LINE 1: USE `yelp_db`;
^
ERROR: syntax error at or near "`"
LINE 1: DROP TABLE IF EXISTS `attribute`;
These are typical MySQL syntax issues that PostgreSQL conforms to the standard on and therefore doesn't support. There are a few different converters on GitHub that might help. When I had to do this last, there were tools to convert text dumps. They didn't work perfectly but they got things close enough. Reviewing the tools around today, they tend to assume you have an actual MySQL database, not just a dump file.
So it looks like the appropriate way to address this today is to load the data into MySQL and then move it to PostgreSQL. In this regard you seem to have four options that I can think of for converting the schema and data:
There are tools to convert XML dumps from MySQL and load these into PostgreSQL.
You could set up a foreign data wrapper from PostgreSQL to the MySQL db and then copy the schemas and data in.
You could manually convert the schemas, and then dump/reload the data using an ETL process via CSV.
There are tools to read a live MySQL database and insert the data into PostgreSQL.

sqlite3 Error when Running in Terminal

I have a .sql file called create.sql. It consists of the following lines:
drop table if exists Items;
drop table if exists Auctions;
create table Items(...);
create table Auctions(...);
When I run:
sqlite3 test < create.sql
It crashes and says, "Error: near line 1: near "drop": syntax error"
Any thoughts?
I just tried this SQL Fiddle, there is no problem with the SQL syntax
The problem seems to be with the way the file is created and looks to be platform specific
if you are using Notepad++ or other editors, try converting the file to Unix style EOL i.e. \n, the file might be having \r\n which sqllit3 is complaining about.

Sql error with backquotes, says there's a syntax error at or near "`"

I'm trying to load a database into Heroku from a sql file, however I get a syntax error from back quotes / backticks.
heroku pg:psql < backup.sql
Outputs this error:
syntax error at or near "`"
Why is that? Aren't backquotes valid?
I can find/replace them with something else if that would be good to try.
are you restoring from a postgresql system or another db software such mySQL?
can you search your backup.sql file for the back-ticks and post that section of your file?
it would help to know if your back-ticks are in the column field names or in the data portion of the SQL statement.