What does SQLCODE: -516 signify - sql

I am able to retrieve data from the same database table but am not able to isert
The error which i get is
DB2 SQL error: SQLCODE: -516, SQLSTATE: 26501, SQLERRMC: null

IBM's documentation suggests that
the currentSchema property does not
match the schema name of the tables
and indexes that you created.
(Although the above is for z/OS, I would expect that the Java DB2 implementation is the same)

When you got SQLCODE that retreive from DB2
you can use following command for describe
DB2 ? SQL-<ERRORCODE>
example
DB2 ? sql-407

Related

Error message DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=MCX28303.BANKACCOUNTS, DRIVER=4.26.14

I am populating data into db2 from my local machine (BankAccounts.sql) while executing the file I'm getting the below error Error message DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=MCX28303.BANKACCOUNTS, DRIVER=4.26.14
Stuck don't know what to do next?
You should learn how DB2 tells you what happened.
In this case the database tells you the code "-204" and the message "MCX28303.BANKACCOUNTS".
The code you have to look up here: ( Which Db2 are you using? this one is for z/OS version 12)
https://www.ibm.com/support/knowledgecenter/SSEPEK_12.0.0/codes/src/tpc/n204.html
And the message points to your mistake.
Finally the IBM-documentation often gives you advice what to do (see "Programmer response").
In my case there is an issue with schema. As you are using MCX28303 as schema you can try to set schema first like
set schema = MCX28303;
and after that you can run your query without schema.
I tried this way and it's working for me.

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

SKIP LOCKED DATA Syntax issue in DB2

I am trying to execute simple select query with SKIP LOCKED DATA
but getting syntax error. Below is the sample query
SELECT ELEMENT FROM WORKQUEUE
WHERE PRIORITY = '1' AND STATUS='OPEN'
SKIP LOCKED DATA;
Got error as below
DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=SKIP;
<query_expression>;END-OF-STATEMENT, DRIVER=3.61.86
But as per documents it is valid query. Please let me know if I am doing something wrong?
I suspect you are not using Db2 for z/OS 10.0.0
I suspect you are using e.g Db2 11.1 and you need a manual page from that Db2 platform such as
"Evaluate uncommitted data through lock deferral" - https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.admin.perf.doc/doc/c0011218.html
because Db2 for Linux, Unix and Windows does not support the SKIP LOCKED DATA clause directly

Facing an error when trying to insert the data in database using db2?

I'm trying to insert a row in the table by using below code but it is throwing an error. can anyone help me out to solve the error?
Thanks in advance!!
db2 "Insert into TARIFF_PRODUCT_ATTRIBUTES values (409499, 'ADDITION_SMS_TEMPLATE', 'IDSSMS1')";
Error is :
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0204N "DB2EAI2.TARIFF_PRODUCT_ATTRIBUTES" is an undefined name.
SQLSTATE=42704
Common causes of SQL0204N in Db2:
spelling mistake in the object name
object does not exist in the currently connected Db2 database
object exists in current database but in a different schema than your current default schema (so you must qualify the name with the correct schema-name).
mixed case table name (Db2 will always uppercase unquoted object names, so if the object is Tariff_Product_Attributes then use double-quotes around the name in the SQL to allow Db2 to find the object).
There are other less common causes , see the documentation for the complete list.

problems with DESCRIBE statement in oracle sql developer using JDBC driver

I just set up a teradata JDBC database through Oracle SQL Developer. I can't get the 'DESCRIBE' command to work, or the 'HELP TABLE' command (usually the case with teradata).
If I put in DESCRIBE tablename ; I get error:
[Teradata Database] [TeraJDBC 14.10.00.26] [Error 3706] [SQLState 42000] Syntax error: expected something between the beginning of the request and the word 'DESCRIBE'.
If I use HELP TABLE tablename ; it gives me a help menu internal to Oracle sql developer
Anyone else have this issue? or know any alternatives to the DESCRIBE command?
Try this:
SHOW TABLE $database.$table