User Profile
Collapse
-
Before deleting activate the not logged initially and commit statement after the delete - would improve the performance. -
declared global temp table with merge
Hi,
Can we use declared global temporary table as source table to merge data into a table in db2 8.2. -
-
Insert into tableb (select col1, col2 from tablea where column = 'active');Leave a comment:
-
Sql performance Tuning
Sql performance tuning in DB2
Table Trans has multiplle records for each employee. I am updating id into lookup from trans .
Currently, it takes 3 minutes to update lookup table. Both lookup and Trans has around 1.5 million test data.
Table Trans can increase upto 1 billion. Is there any better way to increase the performance. I am using db2 udb 8.2 partitoned, aix .
Table TRANS (multiple records for... -
This function works fine. did you drop and rebuild the function and run it?Leave a comment:
-
Yes, Export and recreate the table with column change and import the data.Leave a comment:
-
Hi,
Remove semicolumn (;) after end and try. All the best.
CREATE FUNCTION MAYORRPK(
VALUE1 DECIMAL(6, 3),
VALUE2 DECIMAL(6, 3) )
RETURNS DECIMAL(6, 3)
LANGUAGE SQL
CONTAINS SQL
NO EXTERNAL ACTION
BEGIN ATOMIC
DECLARE RESULTADO DECIMAL(6, 3);
IF (VALUE1 >= VALUE2) THEN
SET RESULTADO = VALUE1;
ELSE
...Leave a comment:
-
Hi,
You have to drop and recreate the table . you cannot rename the column in db2.Leave a comment:
-
-
Hi,
If you want a count of particular column try this
select count(distinct( colname)) from tableLeave a comment:
-
Hi,
declare startime as varchar when you add starttime try this
char(current date) || substr(char(cur rent time),1,5)
which will give date and time.
Hope this helps.Leave a comment:
-
Hi,
UPDATE tab1 a SET a.p_cd = value((SELECT b.p_cd FROM tab2 b WHERE b.type = a.type fetch first row only),'')
|| value((SELECT c.p_type FROM tab3 c WHERE a.no = c.no fetch first row only),'')
It worked . Great!
Thankyou,
HevanLeave a comment:
-
Hi,
I have 3 tables which i have to update tab1 using this update.
tab1 (no integer, type varchar(5), p_cd varchar(10))
values
10, abc1
10, abc1
20, aaa1
20, aaa1
30, bbb1
tab2(p_cd(5), type(5)
values
abc, abc1
aaa, aaa1
bbb, bbb1
cc, ccc2
tab3(no integer, p_type varchar(5)
values
10, 123...Leave a comment:
-
Hi Frozenmist,
Thankyou for your help. Still, It updates spaces if the second select is null.
Instead of abc(with spaces)
Thanks,
Hevan...Leave a comment:
-
Hi,
Try like this
P1: BEGIN
DECLARE GLOBAL TEMPORARY TABLE SESSION.test (num integer)
WITH REPLACE ON COMMIT PRESERVE ROWS ;
p2: begin
declare cur1 cursor with return for
select * from session.test;
insert into session.test values (1);
commit ;
open cur1;
END P2 ;
end p1Leave a comment:
-
Updating a large table
Hi,
I am using this sql for updating a large table.
This sql should update a record like 'abc123'. The first select will return 'abc' and the second select will return '123'.
This works fine if the second select is not null.
If the second select returns null then the updated record should be a.p_cd = 'abc'. But it shows null.
If i use two seperate updates It works fine. But i want to use...
No activity results to display
Show More
Leave a comment: