StackOverflow is a collaborative programming Q&A community venture
Note: The content of this blog is the opinion and thoughts of the blogger and does not necessarily represent the opinions of IDUG.
parallel select data from a db2 table
I am trying to fetch equal number of records from 4 different clients from the same table in db2 database. I need to ensure that each sql fetches distinct set of rows with equal volume. the table has a 18 digit number as a primary key generated randomly. how do I ensure that the record getting select in first sql is not present in any of the other sqls.
Error while deleting from CTE
I am getting error that from statement is required while running the query. There is no code before that. Using the query to delete duplicates. Select in place of delete is working fine but while using the delete throwing error.
DB2: lag functions really slow
I have a big CTE that outputs data with about 50 rows. Let's call this output_no_1. Now, If I add another step in my CTE , to manipulate output_no_1, i.e. add some columns dependent on the columns of output_no_1, my code takes 20 times as long to run.
I wish to understand why that is...
I need to make a bunch of new columns in output_no_2 (output_no_1 contains year_month and I want to compare sales and other stuff from one period to the next):
Update table column based on another table based on ID
I have 2 tables 'table1' and 'table2'.
I want to UPDATE the "PRICE" column of
I got this error message:
I am using DB2.
DB2 Comp and Comp3 datatypes data is unreadable when extracted in a file
We have retrieved data in a file by querying DB2 tables. But the data of column types Comp(Binary) and Comp3(Packed Decimal) are in a unreadable format. We want to read the data through Java. We could understand other columns data. This is required as part of Migration of data from DB2 to Mysql. We can cast the data in a query itself so that data comes in a readable format in the file. But we dont have control over the DB queries. We have only files with data. But we are not able to parse these column(datatypes) data.
Converting a string to a date in DB2
I am working with a DB2 database for the first time.
I am trying to work with DB2 dates, but the data is stored as a string in the DB2 database.
I want to convert this date-string into an actual date, preferably dropping off time because I want all transactions between 1 Jan 2011 and 26 Jan 2011.
So essentially, I want this MS SQL statement in DB2 magic...
For background, I have got as far as
But I need the expert knowledge of a DB2 whizzkid!
DB2: substring a number
In my dataset I have a variable (numeric) which is year+month, called year_month with values 201702, 201703 etc.
Normally my code looks like this:
I wish to extract the month and the year from the year_month variable, but I'm not sure how to do this when year_month is numeric.edit: not a duplicate, different problem, I do not care about dates.
Using CAST to change text field CCSID on rpgle with emb-sql
I have a file defined this way:
I'm working with characters in polish language stored in the "TEXT" field.
If I use this code in my rpgle program:
all the text in first field "TEXT" is converted perfectly and updated in the other field in unicode.
But if the text that I want to convert is in a text field (100c), how can I convert it using SQL?
How to get the index KEY columns by query in db2 v6.1?
I am trying to get the Index key columns from Data base by using SQL.
Currently I am doing in manual way.
Please help me to get all the index key details from query.
FYI (SYSIBM.SYSINDEXES/SYSIBM.kEYS are not working, SYSIBM.tables working)
JDBC Connection to DB2?
We have AS/400 machines from IBM (P8), which uses DB2 database. I want to read the tables from DB2 with a JDBC connection and process it. It is possible to connect to the DB2 database and make sql statements with java program? If yes, can someone show a little sample. Thanks in advance.