Invalid table name while bulk insert in oracle - sql

I am trying to insert values into Oracle table using Bulk Insert query but getting below error
ORA-00903: invalid table name
00903. 00000 - "invalid table name"
*Cause:
*Action:
Error at Line: 4 Column: 5
Here is my query
BULK INSERT TEST1.STUDENT
FROM 'C:\Users\Alan\Desktop\STUDENT.txt'
WITH
(
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
);
Why is this error coming. Is there some issue with query? Please help. Thanks
Update
I changed by file format to CSV and wrote below query
LOAD DATA
INFILE 'C:\Users\Alan\Desktop\STUDENT.csv'
INTO TABLE TEST1.STUDENT
FIELDS TERMINATED BY ","
(ID,
NAME);
but above query is giving
ORA-00928: missing SELECT keyword
00928. 00000 - "missing SELECT keyword"
*Cause:
*Action:
Error at Line: 16 Column: 2
What is wrong in the above syntax?

This is not Oracle syntax at all. If you need to load data from file to table please use either SQLoader or External table
Some documentation about External table and SQLoader
If you're using SQLDeveloper you can also use import facility.
Please also have a look on that thread.
[EDIT}
LOAD DATA
INFILE 'C:\Users\Alan\Desktop\STUDENT.csv'
INTO TABLE TEST1.STUDENT
FIELDS TERMINATED BY ","
(ID,
NAME);
This is not a query. This is content of control file. Please save it to file load.csv then run cmd (or shell if yuo're on Linux) and type:
sqlldr user/pass control=load.ctl
Some examples you can find here.

Related

Inserting values into a hive table issue

I am attempting to insert values into a specific column in a hive table. The following query does not seem to work:
INSERT INTO table DQ_Rules_Status_Table_PROFILER (Load_TimeStamp) VALUES (2020-01-24) where Load_Ts rlike('Jan 24');
The error message received is as follows:
Error: Error while compiling statement: FAILED: ParseException line 1:86 missing EOF at 'where' near ')' (state=42000,code=40000)
UPDATE DQ_Rules_Status_Table_PROFILER SET Load_TimeStamp = '2020-01-24' WHERE Load_Ts rlike('Jan 24');

How to add avro.schema.url to hive partition storage information?

I am trying command
ALTER TABLE mytable PARTITION(date='2010-02-22') SET 'avro.schema.url'
'hdfs://xxx.com:9000/location/to/my/schema/_schema.avsc';
But it is returning parsing Error :
FAILED: ParseException line 1:49 cannot recognize input near 'SET'
''avro.schema.url'' ''hdfs://xxx.com:9000/location/to/my/schema/_schema.avsc'' in alter
table partition statement suffix
This is right syntax:
ALTER TABLE mytable PARTITION(date='2010-02-22') SET TBLPROPERTIES(
'avro.schema.url'
'hdfs://xxx.com:9000/location/to/my/schema/_schema.avsc');

Export file using Sybase Event

I'm trying to output a file to a shared folder, I can make the output but I can't run it on a event/Stored Procedure.
The code snippet that I have to the output is this:
BEGIN
select * from table1; output to 'c:\\teste.txt' format text with COLUMN names
END
But when I include this in a event, the sybase gives me this error.
[Sybase][ODBC Driver][SQL Anywhere]Syntax error near 'output' on line 2
SQLCODE: -131
SQLSTATE: 42000
SQL Statement: ALTER EVENT "dba"."Export" HANDLER BEGIN
select * from table1; output to 'c:\teste.txt' format text with format text with COLUMN names
END
I am using Sybase Central with sql anywhere 12
Use the unload table statment in Event.
"Output to..." will onsly work in DBISQL
Example:
UNLOAD SELECT field1, field2 from table1 to 'c:\temptest.csv QUOTES OFF DELIMITED BY ';';

is "following" a reserved keyword in Hive?

Hive command - create table table_name (accountId string,name string,following string);
throws following exception,
[main] ERROR org.apache.hadoop.hive.ql.Driver - FAILED: ParseException line 2:198 cannot recognize input near 'following' 'string' ',' in column specification
org.apache.hadoop.hive.ql.parse.ParseException: line 2:198 cannot recognize input near 'following' 'string' ',' in column specification
In the below link,"following" is not mentioned in the reserved keywords list,
http://docs.treasuredata.com/articles/faq
I think it might be in the reserved key word list. However you can use the below query to create the column name following.
create table test (accountId string,name string,`following` string);

SQL Server 2008 bulk import issue

Ive been working with this for a while and can't find out what I'm doing wrong. I have a CSV file with data such as
123,Jon,Son,M,1
When I run the query
BULK INSERT MYDB2..Dependent FROM 'c:\db3\db.csv'
WITH
(FIELDTERMINATOR=',',
ROWTERMINATOR = '/n')
I get errors like
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 5 (AGE).
The thing is I made EXACT copies of the tables so there is no way my tables can't match.
I believe the problem is my the format of my query.
It does have a little problem, it should be \n, instead of /n
BULK INSERT [Dependent] FROM 'c:\db3\db.csv'
WITH
(FIELDTERMINATOR=',' ,ROWTERMINATOR = '\n')