Questions tagged [db2-luw]

DB2 for Linux, UNIX and Windows

DB2 for LUW is part of the DB2 family, that runs in these operative system.

Many parts of the internal structure are the same in all members of the DB2 family, but there are also things specific for each architecture.

This tag is for question related specifically to this member of the family.

913 questions
31
votes
7 answers

DB2 Comma Separated Output by Groups

Is there a built in function for comma separated column values in DB2 SQL? Example: If there are columns with an ID and it has 3 rows with the same ID but have three different roles, the data should be concatenated with a comma. ID |…
gaurav
  • 2,886
  • 6
  • 24
  • 26
10
votes
3 answers

Failing update table in db2 with SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 7;

I am using db2 9.5 i have created a column in table which is created successfully but i am not able to update table column and getting following error [Error] Script lines: 1-1 -------------------------- DB2 SQL error: SQLCODE: -668, SQLSTATE:…
WCS Developer
  • 111
  • 1
  • 1
  • 6
9
votes
4 answers

Db2 connection problem with java

I am having problem with DB2. I just installed the db2 as a db2admin and with a password. When i try to connect to database it is success full and while running any simple select query it give me following error:- DB2 SQL Error: SQLCODE=-204,…
RishiPatel
  • 194
  • 1
  • 2
  • 13
8
votes
2 answers

DROP DATABASE fails

I have a DB2 database (let's call it mydb) that I would like to delete. However, when I do db2 drop db mydb I get back SQL1035N The operation failed because the specified database cannot be connected to in the mode requested. …
John
  • 4,786
  • 8
  • 35
  • 44
7
votes
1 answer

How to create a user defined function that returns a table in a DB2 module?

I am trying to create a user-defined function that returns a table in DB2. Here is what I have so far. This is a table that I use: CREATE TABLE "CORPDATA"."EMPLOYEE" ( "EMPNO" CHAR(6) NOT NULL, "FIRSTNME" VARCHAR(12) NOT NULL, …
Andrey Belykh
  • 2,578
  • 4
  • 32
  • 46
6
votes
3 answers

Is there a efficient way to delete every view/function/table/sp from a database?

In a DB2 federated database (based on remote servers and nicknames), I need to clean up the model and recreate it from another database. I need to delete every database object except those servers and nicknames. I know how to retrieve the list of…
Johann Blais
  • 9,389
  • 6
  • 45
  • 65
6
votes
4 answers

IBM DB2: Generate list of dates between two dates

I need a query which will output a list of dates between two given dates. For example, if my start date is 23/02/2016 and end date is 02/03/2016, I am expecting the following…
Goutam
  • 113
  • 1
  • 1
  • 7
5
votes
2 answers

How to find constraints columns in DB2

I want to know the columns (names) which belong to each unique constraint. I can easily find the constraints and the tables names in syscat.tabconst. However I can't find the columns names.
madarinho
  • 87
  • 1
  • 1
  • 10
5
votes
3 answers

How does the HEXTORAW() function work? What is the algorithm?

HEXTORAW is a function found in several RDBMS's like Oracle, and DB2 on LUW. It takes a character, or integer input, and basically casts it to a HEX value. HEXTORAW(1234) = x'1234' What is the algorithm for this type conversion? What is…
Josh Hull
  • 1,723
  • 1
  • 16
  • 24
5
votes
6 answers

how can I rename a table / move to a different schema in sql DB2?

I am trying to rename a table in db2 like so rename table schema1.mytable to schema2.mytable but getting the following error message: the name "mytable" has the wrong number of qualifiers.. SQLCODE=-108,SQLSTATE=42601 what is the problem here....…
brucezepplin
  • 9,202
  • 26
  • 76
  • 129
5
votes
6 answers

DB2: Purge large number of records from table

I am using DB2 9.7 FP5 for LUW. I have a table with 2.5 million rows and I want to delete about 1 million rows and this delete operation is distributed across table. I am deleting data with 5 delete statements. delete from tablename where tableky…
Saurabh Agrawal
  • 1,355
  • 3
  • 17
  • 33
4
votes
1 answer

Query with function taking longer than same query with subselect

I have a function to get the balance for a customer. CREATE OR REPLACE FUNCTION default1.get_balance (par_customer_id DECIMAL(31, 0)) RETURNS DECIMAL(31,15) LANGUAGE SQL DETERMINISTIC NO EXTERNAL ACTION READS SQL DATA BEGIN DECLARE…
raznagul
  • 355
  • 2
  • 19
4
votes
2 answers

How to check the status of long running DB2 query?

I am running a db2 query that unions two very large tables. I started the query 10 hours ago, and it doesn't seem to finish yet. However, when I check the status of the process by using top, it shows the status is 'S'. Does this mean that my query…
panc
  • 817
  • 2
  • 14
  • 30
4
votes
1 answer

Validate dates before conversion, aka. ISDATE() equivalent

DB2 version is 9.7.0.7 I have a flat file, and need to validate fully prior to insert into a production table. For analysis, I've parsed it into a table where all columns are VARCHAR. One of the tasks is to validate dates. I need to be able to…
geolemon
  • 43
  • 5
4
votes
2 answers

TABLE vs TABLESPACE , what's the difference?

I want to know the difference between TABLE and a TABLESPACE in db2-luw.
malmo
  • 484
  • 9
  • 20
1
2 3
60 61