I was trying to import data from an oracle database table using a ctl file. Unfortunately, it doesn't work due to a syntax error and, for my efforts, I can't understand why.
SQL code:
sqlldr USERID=user/password, CONTROL=C:\wkt_building001.ctl, LOG=C:\ulcase1.log
file ctl code:
OPTIONS (readsize=20000000, DIRECT=TRUE)
UNRECOVERABLE LOAD DATA
CHARACTERSET UTF8
INFILE 'C:/wkt_building.txt.001'
APPEND
PRESERVE BLANKS
INTO TABLE wkt_building
FIELDS TERMINATED BY ' ' TRAILING NULLCOLS
(
BUILDING_ID,
BUILDING CHAR(100000)
)
error:
org.jkiss.dbeaver.model.sql.DBSQLException: Errore SQL [900] [42000]: ORA-00900: istruzione SQL non valida
at...
Caused by: java.sql.SQLSyntaxErrorException: ORA-00900: istruzione SQL non valida
at ...
Caused by: Error : 900, Position : 0, Sql = sqlldr USERID=user/password, CONTROL=C:\wkt_building001.ctl, LOG=C:\ulcase1.log data=C:\wkt_building.txt.001, OriginalSql = sqlldr USERID=user/password, CONTROL=C:\wkt_building001.ctl, LOG=C:\ulcase1.log data=C:\wkt_building.txt.001, Error Msg = ORA-00900: istruzione SQL non valida
at ...
thank you in advance
in the wrong initial command the ip address, the port and the database name are missing, this is the correct version:
sqlldr USERID=user/password#10.0.0.116:1521/name_database CONTROL=wkt_face001.ctl LOG=ulcase1.log
Also to configure the connection on cmd follow this guide that uses net menager should have all the steps:
https://www.youtube.com/watch?v=86WxgQdNTYU
Related
While using H2 in postgresql mode, I am unable to load data.sql with above error
basically getting error message expected INDEX, ,, );
Issue was sytax error in sql create statement
there was missing bracket ")" at end of create statement query
create table foo (testdate date, card_uuid uuid, PRIMARY KEY (card_uuid); <- missing bracket here
I keep getting this error for the below MySQL SP
any ideas?
CREATE PROCEDURE productpricing(
OUT pl DECIMAL(8,2), OUT ph
DECIMAL(8,2), OUT pa DECIMAL(8,2) )
BEGIN SELECT Min(amount) INTO pl
FROM Card Error Code: 1064 You have an
error in your SQL syntax; check the
manual that corresponds to your MySQL
server version for the right syntax to
use near '' at line 9 0.000 sec
DROP PROCEDURE IF EXISTS productpricing;
CREATE PROCEDURE productpricing(
OUT pl DECIMAL(8,2),
OUT ph DECIMAL(8,2),
OUT pa DECIMAL(8,2)
)
BEGIN
SELECT Min(amount)
INTO pl
FROM Card;
END;
Did you define a delimiter?
Try adding delimiter // before the CREATE PROCEDURE statement. Also replace END; with END;//. I checked and it works for me.
See the MySQL doc on stored procedures
you need group by if you use min,max i think. if that doesnt work try #p1 to create a temp table. May be problem is the table you are inserting it to.
I am using a SimpleJdbcInsert to insert rows into a PostgreSQL database. However, I get an the following error:
Caused by: org.postgresql.util.PSQLException: ERROR: INSERT has more
target columns than expressions.
org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [INSERT
INTO product (product_id,product_name,product_code,in_
stock,product_category) VALUES(?)]; SQL state [25P02]; error code [0];
ERROR: current transaction is aborted, commands ignored until end of
transaction block; nested exception is
org.postgresql.util.PSQLException: ERROR: current transaction is
aborted, commands ignored until end of transaction block
The number columns is exactly the same as the number of values I am trying to insert when I print out the MapSqlParameterSource object shown below:
Parameters Names ::
[
product_id,
product_name,
product_code,
in_ stock,
product_category
]
Parameters Values :: [{
product_id=1518,
product_name=Sofa,
product_code=150,
in_stock=true,
product_category=null,
}]
The product_id is the primary key and it is not null. Could the problem be because I am not using an auto-generated primary key? I still do not understand why that would be a problem.
The columns shown in the error message are precisely the same as the columns in the parameter list I'm printing. The values also tally with the number of columns as well, so I'm really baffled why PostgreSQL is giving this error. Please help!
I was able to solve it with a different solution to using Spring JDBC.
I am writing a SQL query to use in a Boyum validation that will flag and BP Master Data NAMES that are LIKE
Here is the query I have written
IF OCRD.Cardname IN (Select OCRD.Cardname from OCRD WHERE OCRD.Cardname
LIKE '%'+Cardname+'%')
BEGIN
SELECT 'Duplicate'
FOR BROWSE
END
Here is the error message I have received
[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]The multi-part identifier "OCRD.Cardname" could not be bound.
2). [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Statement(s) could not be prepared.
)
That is invalid SQL you provided. You can't reference a table column like that
IF EXISTS (Select OCRD.Cardname from OCRD WHERE OCRD.Cardname LIKE '%'+Cardname+'%')
BEGIN
SELECT 'Duplicate'
FOR BROWSE
END
i got a HSQLDB 2.2.9 and the following statement:
(SELECT lower(MyCol) FROM MyTable WHERE ID = ?)
MINUS
(SELECT lower(MyCol) FROM MyTable WHERE ID = ?)
And it works in my Squirrel. But when i execute this in my program which uses Jdbc i get the following exception:
Exception in thread "main" org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [(SELECT lower(MyCol) FROM MyTable WHERE ID = ? ) MINUS (SELECT lower(MyCol) FROM MyTable WHERE ID_CENTER = ?)]; Column not found: MyCol; nested exception is java.sql.SQLException: Column not found: MyCol
If i delete the lower() that statement works but its case sensitive which i want to eliminate here.
Can please someone tell me why i get this error and how to fix it?
This exception is not thrown by HSQLDB 2.2.9. If the column could not be found, the exception message would be in this form:
user lacks privilege or object not found: MYCOL
Please check your Spring data source settings.