SLT Transaction LTRS: Error: SQL0104N primary key - view

We try to create a replication with a view using SLT (SAP Landscape Transformation) Replication Server.
Views need to be defined in LTRS !?
When I try to make such a definition I get the error:
SQL0104N An unexpected token ")" was found
following "K" ADD PRIMARY KEY (", Expected tokens
may include "<unique_col_list>". SQLSTATE=42601

This error occurs if there is no primary key in the source table.
Hence the SQL generated by SAP results in an error. Obviously they did not check first if the conditions are met. As a result the error message does only gives an indirect hint.

Related

spring-data-jdbc bad sql grammar on update

In spring-data-jdbc 2.3.2 with 2.6.4 data-jdbc starter. I am seeing the following output. Not clear if this is my error in a model layer or an issue with the framework.
This happens when the root aggregate tries to get updated because of a one-to-many reference modification.
As far as I can tell the SQL spec expects a SET statement here. This is the exception I am getting :
Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE "tb_entity" WHERE "tb_entity"."field_id" = ?]; nested exception is org.postgresql.util.PSQLException: ERROR: syntax error at or near "WHERE"
Position: 21
Any suggestion is welcome.
Take a look at the foreign table primary key. Even though not strictly necessary to be in consistent state. Anyways, one of the statement of 3NF is that all records in a table must be uniquely identified not matter if they don't represent an entity perse. Data-jdbc uses this key for the relations with List, Set, Map.
https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/#jdbc.entity-persistence.types

LINKED TABLE WITH QUERY INSIDE CONTAINS "/" IN COLUMN NAME

I'm trying to create an H2 link to an oracle database with this query :
CREATE LINKED TABLE MyLinekTable('oracle.jdbc.OracleDriver','jdbc:oracle:thin:#127.0.0.1:1521:orcl','login','password','(SELECT "/BIC/ZBSARK" as FLOW FROM MYTABLE)');
And i get this error :
Error: ORA-01424: missing or illegal character following the escape character
; SQL statement:
CREATE LINKED TABLE P710_ParamFRS2('oracle.jdbc.OracleDriver','jdbc:oracle:thin:#127.0.0.1:1521:orcl','login','password','(SELECT "/BIC/ZBSARK" as FLOW FROM ZPARAM_FRS)') [1424-197]
SQLState: 22025
ErrorCode: 1424
I tried to escape the "/" with "\" and [] and \Q..\E but no sucess !
My remote table (on oracle) contains 2 columns : /BIC/ZBSARK and PLANT
[create table MYTABLE(
"/BIC/ZBSARK" varchar(20),
PLANT varchar(20))]
When i try with the PLANT column instead of the "/BIC/ZBSARK" column, this work well :
CREATE LINKED TABLE MyLinekTable('oracle.jdbc.OracleDriver','jdbc:oracle:thin:#127.0.0.1:1521:orcl','login','password','(SELECT "PLAN as FLOW FROM MYTABLE)');
I tried to escape the "/" with "\" and [] and \Q..\E but no sucess !
Can some one help or has the same problem ?
Thanks a lot !
This is an H2 database bug. An issue was filled about it on GitHub:
https://github.com/h2database/h2database/issues/2073
The fix will be available on the standard version after h2-1.4.199.
If needs, you can build H2 from its current sources and use the generated jar.
Sources are here:
https://github.com/h2database/h2database
Building instructions are here:
https://h2database.com/html/build.html#building

Oracle destination in SSIS data flow is failing with Error- ORA-01405: fetched column value is NULL

I have one SSIS package in which there is one DFT. In DFT, I have one Oracle source and one Oracle destination.
In Oracle destination I am using Data Access Mode as 'Table Name - Fast Load (Using Direct Path)'
There is one strange issue with that. It is failing with the following error
[Dest 1 [251]] Error: Fast Load error encountered during
PreLoad or Setup phase. Class: OCI_ERROR Status: -1 Code: 0 Note:
At: ORAOPRdrpthEngine.c:735 Text: ORA-00604: error occurred at
recursive SQL level 1 ORA-01405: fetched column value is NULL
I thought it is due to NULL values in source but there is no NOT NULL constraint in the destination table, so it should not be an issue. And to add into this, the package is working fine in case of 'Normal Load' but 'Fast Load'.
I have tried using NVL in case of NULL values from source but still no luck.
I have also recreated the DFT with these connections but that too in vain.
Can some one please help me with this?
It worked fine after recreating the oracle table with the same script

How to solve : SQL Error: ORA-00604: error occurred at recursive SQL level 1

When I'm trying to drop table then I'm getting error
SQL Error: ORA-00604: error occurred at recursive SQL level 2
ORA-01422: exact fetch returns more than requested number of rows
00604. 00000 - "error occurred at recursive SQL level %s"
*Cause: An error occurred while processing a recursive SQL statement
(a statement applying to internal dictionary tables).
*Action: If the situation described in the next error on the stack
can be corrected, do so; otherwise contact Oracle Support.
One possible explanation is a database trigger that fires for each DROP TABLE statement. To find the trigger, query the _TRIGGERS dictionary views:
select * from all_triggers
where trigger_type in ('AFTER EVENT', 'BEFORE EVENT')
disable any suspicious trigger with
alter trigger <trigger_name> disable;
and try re-running your DROP TABLE statement
I noticed following line from error.
exact fetch returns more than requested number of rows
That means Oracle was expecting one row but It was getting multiple rows. And, only dual table has that characteristic, which returns only one row.
Later I recall, I have done few changes in dual table and when I executed dual table. Then found multiple rows.
So, I truncated dual table and inserted only row which X value. And, everything working fine.
I know the post is old and solved, but maybe someone is facing or will face my situation, so I want to leave the aquired knowledge here, after deal with the error for a week. I was facing the error: "ORA-00604: error occurred at recursive SQL level 1" , but with the internal error: " ORA-06502: error: character string buffer too smal numeric or value", this happened only when I try to logon the database, and using an specific driver, trying to connect from an Visual Studio C# application, the weirdest thing on that moment was that I connect from SQLDeveloper or TOAD and everything worked fine.
Later I discovered that my machine name had this format "guillermo-aX474b5", then I proceed to rename it like this "guillermo" without the "-" and the other stuff, and it worked!! Looks like in some drivers and situations, ORACLE Database does'nt like the "-" in the LogOn connection.
Hope it helps!

ORA-01422 error on recompilation/revalidation (NOT EXECUTION) of package/trigger

I'm running into a problem where I'm trying to grant execution on a package to another schema.
GRANT EXECUTE ON PP.PKG_PROF TO PPSERVICE;
Looks like Oracle attempts to recompile/revalidate the package before making the grant. However it is failing with the following error:
GRANT EXECUTE ON PP.PKG_PROF TO PPSERVICE
Error report -
SQL Error: ORA-04045: errors during recompilation/revalidation of PP.PKG_PROF
ORA-20000: ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 83
04045. 00000 - "errors during recompilation/revalidation of %s.%s"
*Cause: This message indicates the object to which the following
errors apply. The errors occurred during implicit
recompilation/revalidation of the object.
*Action: Check the following errors for more information, and
make the necessary corrections to the object.
But if i look at the code on line 83, it executes the following query:
select 'x' into vtemp
from cust_field_vals
where cust_fields = vin_cust_fields
and userid = vin_user_id;
vin_cust_fields and vin_user_id are parameter based values that are provided when the procedure in the package gets called.
My question is: what in the world is oracle doing? I understand that a "SELECT INTO"
can theoretically return more than the requested number of rows (which would need to be one in this case), but since it doesn't know what my vin parameters are, how can it make that assessment? Why is a recompilation/revalidation throwing what essentially amounts to an exception for a data anomaly which it shouldn't even be looking at for what I'm trying to do (ie: i'm not trying to actually execute the procedure).
This is not the first time I've seen this, and if I remember correctly, I even think it's happened on recompilation of triggers as well (not when inserting data).
Any thoughts? Thanks!
apparently, the problem was the package i was trying to GRANT execute on was "invalid" even though there were no actual code errors. Compiling the body first was generating the above mentioned error. If I manually compiled the package spec first, then the body, the error went away and the grant executed normally. No code errors were present in the package, it was just stuck in an invalid state it could not get out of.

Resources