I am trying to insert an xml file into oracle table. I got the error as
ORA-19114: error during parsing the XQuery expression:
ORA-06550: line 1, column 13:
PLS-00201: identifier 'SYS.DBMS_XQUERYINT' must be declared
ORA-06550: line 1, column 7:
I figured out that I need to have DBMS_XQUERYINT object in my db. I ran the package available ...product\10.2.0\server\RDBMS\ADMIN. But package is not getting compiled successfully. Any help is appreciated
Related
Failed to create table: Error while reading data, error message: Error detected while parsing row starting at position: 0. Error: Bad character (ASCII 0) encountered.
This is the error message when I type it into SQL to create a table from my csv format document.
Can't find where is this typo or something - everytime getting this error line 33, in <module>
c_a.execute('ATTACH DATABASE temp.db AS check')
sqlite3.OperationalError: near "check": syntax error
I'm trying to attach database temp.db to the prime.db due one query. This has help me to find duplicate records (checking login (one of the columns in both databases))
import sqlite3
db_a = sqlite3.connect('prime.db')
c_a = db_a.cursor()
db_b = sqlite3.connect('temp.db')
c_b = db_b.cursor()
c_a.execute('ATTACH DATABASE temp.db AS check')
c_a.execute('SELECT * FROM check.user_info WHERE user_info.login = user.login')
db_a.commit()
c_a.fetchall()
Also tried another version:
attachDatabaseSQL = "ATTACH DATABASE temp.db AS check"
dbSpec = ("temp.db",)
c_a.execute(attachDatabaseSQL, dbSpec)
c_a.execute('SELECT * FROM check.user_info WHERE user_info.login = user.login')
db_a.commit()
c_a.fetchall()
It found the error:
line 41, in <module>
c_a.execute(attachDatabaseSQL, dbSpec)
sqlite3.OperationalError: near "check": syntax error
Use Python 3.8.1 and SQLite3.
UPDATE:
Changed it to:
c_a.execute('ATTACH DATABASE temp.db AS dbcheck')
c_a.execute('SELECT * FROM check.user_info WHERE user_info.login = user.login')
db_a.commit()
c_a.fetchall()
And the ERROR NOW IS:
c_a.execute('ATTACH DATABASE temp.db AS dbcheck')
sqlite3.OperationalError: no such column: temp.db
ATTACH DATABASE temp.db AS check;
check is a reserved word in SQLite, as in most (if not all) other databases. In the syntax, it comes into play to define check constraints when creating tables.
Consider using another name, that does not conflict with a language keyword. For example:
ATTACH DATABASE temp.db AS dbcheck;
I'm trying to import the Yelp data from their sql file into a postgreSQL 10 database on Windoes by running the code:
psql -U postgres yelp_db < yelp_sql
and getting the errors below. As you can see it is probably due to the ` character. Is there any way to easy fix that? The file is 7.3GB so I'd like to avoid having to read it line by line to change the ` character to '.
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`;
^
ERROR: syntax error at or near "`"
LINE 1: CREATE TABLE `attribute` (
I have developed following code to call a sql file from shell script testshell.sh
#!/usr/bin/env ksh
feed=`sqlplus -s uname/pwd <<-EOF
#test.sql 'Test_VAl'
/
exit;
EOF`
echo $feed;
My sql file is test.sql which contains following:
Declare
attributeName varchar2(255):=&1;
BEGIN
DBMS_OUTPUT.put_line (attributeName);
END;
I am getting following error while execution.
old 3: attributeName varchar2(255):=&1;
new 3: attributeName varchar2(255):=Test_VAl;
attributeName varchar2(255):=Test_VAl; test.sql testshell.sh
ERROR at line 3:
ORA-06550: line 3, column 31: PLS-00201: identifier 'TEST_VAL' must be declared
ORA-06550: line 3, column 16: PL/SQL: Item ignored
ORA-06550: line 5, column 25: PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 5, column 3: PL/SQL: Statement ignored
Please tell me how to fix this issue.
If your substitute variable is a string then you need to quote it when it's used, not when it's passed in. At the moment it doesn't have quotes so it's treated as an object identifier, and there is no matching object or variable, hence the error.
So your SQL script would be:
set verify off
DECLARE
attributeName varchar2(255):='&1';
BEGIN
DBMS_OUTPUT.put_line (attributeName);
END;
/
Of course you don't need to define a local variable but I assume you're experimenting with simple cases for now.
The set verify off stops the old and new messages being displayed. Thos are useful for debugging but otherwise are usually just noise.
Then you can call it with:
feed=`sqlplus -s uname/pwd <<-EOF
#test.sql Test_VAl
exit;
EOF`
Or if you include the exit in the script you can do:
feed=`sqlplus -s uname/pwd #test.sql Test_VAl`
I'm trying to import a large .sql file into an SQLite .db file, but I'm getting the following errors:
sqlite> .read ./smsCorpus_en_2012.04.30.sql
Error: near line 23: near "COMMENT": syntax error
Error: near line 50: near "LOCK": syntax error
Error: near line 52: near "some1": syntax error
Error: near line 58: near "s": syntax error
Error: near line 60: near "s": syntax error
Error: near line 66: near "UNLOCK": syntax error
The file is located at http://wing.comp.nus.edu.sg:8080/SMSCorpus/data/corpus/smsCorpus_en_sql_2012.04.30.zip (direct file link) linked on this page http://wing.comp.nus.edu.sg:8080/SMSCorpus/history.jsp
EDIT: just a warning, the file is quite large...not sure if this is the issue?
That file is a MySQL dump.
To make SQLite understand it, you have to:
delete COMMENTs on the table fields;
remove AUTO_INCREMENT from id (INTEGER PRIMARY KEY fields are autoincrementing in SQLite anyway);
remove ENGINE and DEFAULT CHARSET;
remove LOCK/UNLOCK commands;
make the INSERT commands have fewer records;
replace \' quoting with ''.
That is a MySQL Dump and not SQLite.
There are slight variations on the syntax.