ERROR 1064 (42000) at line 38: check the manual that corresponds to your MySQL server version for the right syntax to use near '// - mysql-error-1064

I am trying to run a mysql script on centos. I have following mysql installed.
mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------------------------------+
| innodb_version | 5.6.25-73.1 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.6.25-73.1 |
| version_comment | Percona Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+------------------------------------------------------+
My sample script looks like:
DELIMITER //
DROP TRIGGER IF EXISTS trg_table1_category_insert;
DROP TRIGGER IF EXISTS trg_table1_category_update;
CREATE TRIGGER trg_table1_category_insert
AFTER INSERT
ON
table1_category
FOR EACH ROW
BEGIN
insert into table1_category_history (
table1_category_history_id,
table1_id,
transaction_start_date
) values (
new.table1_category_id,
new.table1_id,
new.create_date
);
END;
//
CREATE TRIGGER trg_table1_category_update AFTER UPDATE on table1_category FOR EACH ROW
BEGIN
insert into table1_category_history (
table1_category_history_id,
table1_id,
transaction_start_date
) values (
new.table1_category_id,
new.table1_id,
new.create_date
);
END;
//
DELIMITER ;
My database utilizes utf8 encoding. While importing this file in database on mysql client it keeps throwing
ERROR 1064 (42000): 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 '//
CREATE TRIGGER trg_table1_category_update AFTER UPDATE on ta' at line 1
I do not see any syntax error while using the delimiter, also it works on some machines absolutely fine, i have googled almost 100s of links and tried all the ways with downgrading/upgrading mysql server/client , my.cnf, charset etc it is not helping me out. Can anyone please help me on this? Can there be any settings done at client level to interpret it correctly.I am using the same version client that comes with mysql server installation.

Related

unixODBC isql set hive config variable

I have a unixODBC connection with hive:
isql -v Hive
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
E.g. select install_dt, count(1) from device_metrics.sometable where install_dt >= '2020-04-10' group by install_dt;
Returns expected results.
I would like to run this query but with some hive variable settings. For example, I would liek to set the execution engine to be mr not default tez. When connected to hive directly, outside of odbc I can just do:
set hive.execution.engine=mr;
select ... [my query to run with mr here...
With isql I tried this:
SQL> set hive.execution.engine=mr;
SQLRowCount returns -1
I'm not really sure what SQLRowCount returns -1 but I guess it means either it was an error or no rows were affected?
Either way, I tried running my select query again after trying to configure this setting:
SQL> set hive.execution.engine=mr;
SQLRowCount returns -1
select install_dt, count(1) from device_metrics.sometable where install_dt >= '2020-04-10' group by install_dt;
When I then look at our hadoop running applications page I can see my second attempt at the query but it's still running with tez. Expected and desired behavior was that it would run with mr.
Is it possible configure hive settings with unixODBC connection? If so How can I tell hive to use mr engine and not tez?

Insert Special characters 'Mongolian tögrög' and symbol '₮' in Oracle Database

I need to insert currency Mongolian tögrög and symbol ₮ to Oracle Database.
The insert query as :
INSERT INTO CURRENCY (CUR_ISO_ID, CUR_ISO_CODE, CUR_DESC, CUR_DECIMAL_PLACE, CUR_SYMBOL)
VALUES (496,'MNT','Mongolian tögrög',2,'₮');
results as:
CUR_ISO_ID | CUR | CUR_DESC | CUR_DECIMAL_PLACE | CUR_SYMBOL |
-----------------------------------------------------------------------
496 | MNT | Mongolian t?gr?g | 2 | . |
Kindly advise on how to get the special characters inserted as is to the Database? i.e. the symbol not as . but ₮ and the description not as Mongolian t?gr?g but Mongolian tögrög. Please help.
Before you launch your SQL*Plus enter these commands:
chcp 65001
set NLS_LANG=.AL32UTF8
The first command sets codepage of cmd.exe to UTF-8.
The second command tells your database: "I am using UTF-8"
Then you sql should work. I don't think there is any 8-bit Windows codepage 125x which supports Mongolian tögrög.
See also this post to get some more information: NLS_LANG and others
Check also this discussion how to use sqlplus with utf8 on windows command line, there is an issue when you use UTF-8 at command line.

How to store bank transaction data using Hive / Pig in Hadoop

I have transaction data as shown below.
I need to store the data using Hive / Pig and should be able to query.
Can any one suggest me a way to store and retrieve the data shown below
( note: every new line starts with 0001)?
id |cusid |txndata
0001|000000001|01|0|AB...#GMAIL.COM|MR.XYZ|999 xxxx AVE|EDISON, NJ|.|.|UNITED STATES - 08820|NRI|E|101601075073||
0001|000000001|02|2|101601075073|INR??21656|Savings|N|0|N| | | | | |
0001|000000001|04|0|N|??21656|000000000001|INR??43800|15-04-2011|43800|2.53|12|0|44919|15-04-2012|N
0001|000000001|04|0|N|??21656|000000000002|INR??43800|15-10-2011|44715|7|6|0|46292|15-04-2012|N
0001|000000001|04|0|N|??|000000000003|USD??1000|05-04-2011|1000|1.78|12|1|1018.23|06-04-2012|N
0001|000000001|15|0|000000000004??INR|000001|04-04-2011|B/F ||0|0|0|||AMEERPET|
0001|000000001|15|0|000000000001??INR|000002|26-04-2011|USD500#43.80LESSFCST25 ||0|21875.00|21875.00|||AMEERPET|15-04-2011
0001|000000001|15|0|000000000001??INR|000003|29-04-2011|DCARDFEE16004889APR11-MAR12+ST ||219.00|0|21656.00|||HYD SV ROAD|29-04-2011
0001|000000001|22|0|000000000001??INR|0||||||||||
0001|000000001|25|0|0.00|0.00||||||||||
0001|000000001|65||9401150684744302|625301222448|7|0|1664|2|01-07-2012| | | | |
If the line terminator is '\n' it is pretty much straight forward.
But If the line terminator is '0001' as of hive version 0.13 custom line terminators are not supported in hive. Default Line Terminator is '\n'.
LINES TERMINATED BY only supports newline '\n' right now
This is resolved as per
https://issues.cloudera.org/browse/DISTRO-498?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel.
we can implement Custom Input Format as a workaround.
Custom InputFormat with Hive
This will give more insight on how to implement

How to repair or ignore corrupted blocks in oracle in noarchivelog mode

I have a table with partitioned by date. Today when I run query for entire month I get following error:
SQL Error [1578] [72000]: ORA-01578: ORACLE data block corrupted (file # 10, block # 19007437)
ORA-01110: data file 10: '\UDR''
unfortunately all this long the database was in no archive log mode as now I know. So further investigating I found out that this block is in partition 9 of the table which holds 9th of Feb data.
So how can I recover from this issue? I try to to validate the blocks from rman and then try to recover it, but I get message that there is no back up for that since my db was in no archivelog mode
any help to either ignore it while running query or if I drop the data of 9th feb and reload them will that fix the issue?
when I do
select * from v$database_block_corruption
file | block# | blocks | corruption_change# | corruption_type |cond_id
10 | 1 | 19007437| 0 | fractured | 0
when I select the block from dba_extents then I see
segment_name | segment_type | block_id
tablename | partitionname | 19007437

squirrelsql doesn't like query_to_xml

I am using an SQL that includes query_to_xml:
select query_to_xml('select 1+1 answer', true, true, '') as_xml;
When any SQL with query_to_xml is executed in Squirrel SQL it will result in:
| as_xml |
+--------------------+
|<UnknownType (2009)>|
With the same JDBC driver, credentials and a Java class the SQL will result in the expected XML output:
| as_xml |
+------------------------------------------------------------+
| <row xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">|
| |
| <answer>2</answer> |
| </row> |
I can execute other functions in Squirrel and they will respond, like select version().
Is this a known feature in Squirrel?
If you are using the latest squirrel client, Go to File, Global Preferences-> Data Type Controls, check the box under Unknown DataTypes section.
Rerun the query, it might work.
It seems to be an issue with the text option output for SQL results. It works if you change to the tabular output. Go to the Session menu and click "Session Properties". On the "General" tab under "Output" change "SQL Results" from Text to Table and rerun the query. You may need to close the existing results tabs first.
If this fixes it please add a bug report so that it can be fixed in the future.

Resources