Questions tagged [db2-luw]
DB2 for Linux, UNIX and Windows
913
questions
0
votes
0
answers
22
views
flyway-9.21.2 updates CURRENT_SCHEMA in Db2
I upgraded to flyway-9.21.2 and a migration that replaces an external function written in Java fails because db2 can not locate the jar file for the implementation. This works in 8.4.1 and I think I ...
0
votes
1
answer
46
views
Reset DENSE_RANK() OVER partition by where just one row is different
The set of data that I have has gap between dates and with Lag() function I calculated the number of months that gap exists. Then in second query with dense_rank() I count active Months for each ID. ...
0
votes
1
answer
46
views
SQL Error [42703]: "ILQASRC" is not valid in the context where it is used.. SQLCODE=-206, SQLSTATE=42703, DRIVER=4.31.10
Stored procedure not getting executed on DB2 luw via Dbeaver Application.
I created a stored procedure under my schema 'ILQASRC' which exists in a DB2 luw database. The code of the procedure is as ...
0
votes
1
answer
38
views
What is the unit of Estimated Cost in the output of db2expln command?
Generated explain plan of a query in db2 11.5.
Received the following output:
Estimated Cost = 22.776293
Estimated Cardinality = 0.000000
What is the unit of Estimated Cost in the output of db2expln ...
0
votes
1
answer
38
views
Db2 SQL: repeat row using CTE
I use following (dummy) code to generate repeated row:
Results in error:
08:33:12 FAILED [WITH - 0 rows, 0.235 secs] 1) [Code: -343, SQL State: 42908] The column names are required for the ...
0
votes
0
answers
31
views
How to convert JSON document with arrays to relational table using JSON_Table - UDB v.11.1
Newbie here. Can someone please help me? I'm trying to use "JSON_TABLE" to convert a json document with arrays into a relational table, but I'm getting the following error. I'm using DB2-...
0
votes
1
answer
51
views
db2prereqcheck hangs on some linux systems
When doing a db2prereqcheck on a linx system, it hangs and doesn't ever come back.
The db2prereqcheck command is not only executed manually when one wants to install db2 components. It is also called ...
2
votes
1
answer
128
views
Convert Date to Integer or Dec
I would like to join on yyyymm OF a Date and wanna see which has better performance.
ON A.CLM_NB = B.CLM_NB
AND LEFT(DEC(HEX(Date)),4) = LEFT(DEC(HEX(CLM_Date)),4)
or
ON A.CLM_NB = B.CLM_NB
AND DEC(...
0
votes
2
answers
43
views
DB2 Group by specific columns
ID_1
ID_2
ID_3
LANG
1
11
111
F_lang
1
11
111
null
2
22
222
null
Is it possible to build a query which returns only these two lines below.
It should be grouped by the first three columns and ...
1
vote
1
answer
81
views
Dockerized jBPM with DB2 Fails Upon Docker Restart
Dockerized jBPM with DB2 Fails Upon Docker Restart
Hello Stack Overflow Community,
I've encountered an issue with my Docker container that's running jBPM with a DB2 database. The issue arises ...
0
votes
0
answers
111
views
How to handle error SQL0443N when using 'SYSPROC.ADMIN_GET_MSGS' in DB2?
I am trying to perform DB2 import/export by using JDBC.
As the offical document suggests, I have to execute
call sysproc.admin_cmd(import...messages on server...)
first, then retrieve the messages ...
0
votes
0
answers
75
views
Pentaho - Change setting in 'Feature List' for 'IBM DB2 '
When you create new conection in pentaho for 'IBM DB2', 'Native (JDBC)'.
The 'Feature List' has default setting for 'SQL: truncate table' as 'ALTER TABLE "TABLE" ACTIVATE NOT LOGGED ...
-1
votes
1
answer
63
views
Getting week # from date in SQL with strange company rules
I'm attempting to convert dates to week numbers in SQL. I need to implement it in DB2 and Redshift queried via DBeaver and SAS. None of the weekpart functions follow our rules, and we're not allowed ...
0
votes
1
answer
28
views
DB2 Selective Select
Is it possible select only the columns from the base table without list all the columns, meaning all columns wihout rn column.
This will not work...
select tt.t.*
from (
Origin:
select *
from (
...
0
votes
1
answer
46
views
DB2 Build special select
I have a table with multipe primary keys ID and ANUMBER.
ID (PK)
ANUMBER (PK)
NAME
OPTION
1
1
A
true
1
2
B
true
1
3
C
false
2
1
AA
true
So what I want to get by the Select is
ID (PK)
ANUMBER (...
0
votes
1
answer
61
views
DB2 Prechecks in stored procedure using mulitple conditions
I am calling a stored procedure which should make some prechecks.
Currently I am going through all checks. When one check is failed, than it should throw the exception.
How can I realize it?
DECLARE ...
0
votes
2
answers
134
views
How to declare timestamp variable with default as current timestamp not working
In my stored procedure, I want to set as default timestamp the current time.
But I am running in a compilation error, but with additional set, it will work.
DECLARE VSTART TIMESTAMP DEFAULT CURRENT ...
0
votes
1
answer
106
views
db2 backup image name
In deferent instances of db2 I got different image name.
The biggest part
after command "backup database sample to /tmp/1"
returned file
/tmp/1/SAMPLE.0.DB2.NODE0000.CATN0000.20240421171717....
0
votes
1
answer
29
views
DB2 LUW - log SQL commands/statements executes by a particular user
Please let me know the procedure or method to track db2 luw sql commnads executes by a particular user.
How we can achieve it.
Thanks,
Naikum
1
vote
2
answers
233
views
DB2 query for locks and deadlocks
Is it possible to figure out locks/deadlocks via a query in DB2. During inserts on tables which has installed triggers, locks are made on such tables.
0
votes
0
answers
37
views
IBM DMC tableindex tableindex_performance table are too big
I'm using IBM Data Management Console v. 3.1.9.0 and I monitor 29 DBs. Lately the IBMCONSOLE tables are getting too big (last month they've grown over 300% each).
TABLEINDEX_PERFORMANCE is > 9 GB
...
0
votes
2
answers
103
views
DB2 trigger after update, update singl;e column n the updated row in the same table
Using DB2 on cloud ( LUW )
I want to update a single column value in a row, after any of the other values in that row get updated.
The following AFTER INSERT works
CREATE TRIGGER CENTRAL_REPOSITORY....
0
votes
0
answers
32
views
DB2 Trigger checks after insert
I have a trigger for only some checks.
But when I declared it as
BEFORE INSERT, the constraint checks are made after trigger checks.
AFTER INSERT, the constraint checks are made before trigger checks.
...
0
votes
1
answer
54
views
DB2 IF condition in trigger
I have something like this in my trigger
IF(VAR_ENABLED AND ((SELECT 1 FROM .... OR SELECT 1 FROM ...))
I noticed that the second condition is executed anyway when VAR_ENABLED is set to FALSE
0
votes
3
answers
161
views
DB2 Milliseconds between two dates
I have two dates with datatype timestamp(10). Now I want to calculate the milliseconds between these two dates.
SELECT TO_CHAR(TIMESTAMPDIFF(1,CHAR(endtime- starttime))) AS "ms"
FROM TABLE
...
0
votes
1
answer
286
views
DB2 stored procedure to run multiple insert & update SQL statements using List array from Java application
I want to use a DB2 stored procedure to run multi insert & update SQL statements from my Java application. I have prepared below procedure that contains error.
In this implementation, I first want ...
0
votes
1
answer
41
views
DB2 Cutted trigger message
I have implemented a trigger with very large exception message, doing on this way
SIGNAL SQLSTATE '010101' SET MESSAGE_TEXT = MY_TEXT;
In case, this error occurs, the message is cut off. I think in ...
0
votes
1
answer
96
views
Strange numbers in db2top
I occasionally use db2top to get a quick overview of what is happening. I think I've seen it before but not reflected over it, but today I noticed that there are some strange numbers in the Tables ...
0
votes
1
answer
186
views
Db2 stored procedure returns either empty result set or show "No suitable driver found" error
I am totally got stuck on this DB2 stored procedure & java routine thing and would like to ask and see if anybody see some similar and get a solution for it. Basically, I am trying to write some ...
0
votes
0
answers
50
views
DB2 problem loading Byte data type into DB2BulkCopy in C#
I have a multi-database application where the user can specify different data types to be bulk loaded into tables. One such data type is the System.Byte data type. So essentially they specify that the ...
0
votes
1
answer
129
views
DB2 Identify unused index
Is it possible to identify unused indexes? In our database we have a lot of indexes in the meanwhile. So it will be helpful when it will exist a system table to figure out these indexes.
0
votes
0
answers
63
views
Db2 LUW alter table on HADR - weird behaviour
I know the topic sounds weird, but the behaviour was weird as well.
I have a Db2 LUW 11.5.7 database on 2 nodes with HARD and TSA.
I wanted to execute the following command:
alter table T_EVENTS alter ...
0
votes
2
answers
128
views
How to Rollback DB2 Ingest statement for malformed data
I have a Bash Shell Script that runs a DB2 sql file. The job of this sql file is to completely replace the contents of a database table with whatever are the contents of this sql file.
However, I also ...
0
votes
1
answer
339
views
Docker/DB2 - Released lock on the file /database/config/db2inst1/sqllib/ctrl/db2strst.lck - how to fix this?
I try to run the ibmcom/db2 image from ther Docker hub and it's not working..
When I do the docker run docker run --name mydb2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=...
0
votes
1
answer
121
views
DB2 Logging in stored procedure
Is it possible to create log outputs in a specific mode like debug or info within a stored procedure?
I just know only awared about the cmd DBMS_OUTPUT.PUT_LINE. But I need it with specification of ...
0
votes
0
answers
38
views
How to make it work different platform of ibm db2 core library?
IBM has created two separate NuGet packages for the DB2 core (for Windows and Linux), leading to an architectural issue. This issue has arisen because my hosting environment is on Linux, while my ...
0
votes
0
answers
39
views
Instant logging and file generation in Db2
I am currently using Community version on linux server, have configured db2audit process
Which generated audit files at respective location. Then user have to manually execute db2audit archive command ...
0
votes
1
answer
101
views
DB2 Building json using JSON_ARRAY
I am using DB2LUW 11.5.
I am building a JSON under usage of the below tables and want an output like this
I tried many things but I come not up to a solution.
{
"ID": 1,
&...
0
votes
1
answer
114
views
DB2 Avoid Duplicates in JSON_ARRAY
I am using DB2LUW 11.5.
I build a json and gets an output like this
{
"ID": 1,
"NAME": "a",
"B_OBJECTS": [{
"ID&...
0
votes
1
answer
170
views
Why I get this error? SQL0551N The statement failed because the authorization ID
I want to create a view from another view that I have select statement privilege. However, I can't and I am getting this error. Do you know why? Do I need other type of Select privilege?
SET CURRENT ...
0
votes
0
answers
43
views
DB2 performance lack in subselect
In my subselect, I select for a view, which takes 30% longer time
then to copy the content of the view into this query.
Is their any solution to handle this with a view.
select *
from abc
...
0
votes
1
answer
24
views
DB2 Using max aggregate function
Can I rewrite this select without using aggregate function to retrieve the highest value
Select *
From A
Where Id= 123
and value = (
select max(value)
from A inner
where inner.id = 123 )
0
votes
0
answers
38
views
DB2 Select clause or using cursor
For reading bulk data from within a db2 function, is it preferred to read it via a general select clause or is it better to use here a cursor in relation to performance?
0
votes
2
answers
144
views
Higher precision on current_timestamp?
More of an amusement than a real problem, but is it possible to get higher precision than microsecond in current_timestamp. Syntactically:
values current_timestamp(12)
works fine, but the last 6 ...
0
votes
1
answer
80
views
DB2 throw exception in case block
In my trigger I want to throw an exeption, but it is not working properly, got exception. Using DB2 LUW
{0:0} An unexpected token "SQLSTATE '1234'" was found following "
SIGNAL&...
0
votes
1
answer
45
views
DB2 With in clause, cache variable
According to the example of Generate aggregated Json data from Json string in java, I want to cache the result length in a variable within a function
DECLARE result CLOB;
DECLARE leng INT;
WITH ...
0
votes
1
answer
45
views
DB2 show json_object as null if empty
I want that the output of the select for the column FORMATTED_JSON is null if it is empty instead of empty object, means
IDENTIFIER | FORMATTED_JSON
1 | null
This is the query:
SELECT ...
0
votes
0
answers
45
views
DB2 read bulk data
I am reading bulk data from database with a size of 100mb.
What I am doing is reading it in a procedure and building a xml which is amazingly very fast.
So I am calling the stored procedure via ...
0
votes
1
answer
308
views
Db2 error "An expression in the ORDER BY clause .. is not valid." when using LISTAGG(DISTINCT ..)
This query seems to be valid in Db2 v11.5.7.0:
SELECT listagg(DISTINCT x, ',') WITHIN GROUP (ORDER BY x)
FROM (VALUES (1), (1), (2)) t (x)
But it fails with:
SQL Error [42822]: An expression in the ...
0
votes
0
answers
95
views
Db2 LUW Java SP issue
I am trying to run a Stored Procedure which has registered as an external Java Program to Db2. Whenever I call it, I keep getting the error:
SQL4304N Java stored procedure or user-defined function
&...