swapnil kataria

Ranch Hand
+ Follow
since Feb 26, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by swapnil kataria

thanks Martin
I got it now
hi Martin Vajsar

My DB is postgresql, and in a STORE_PROC , i have to do updates in a loop for a table,
suppose that loop do 100 updates one by one, I want to do it in a single batch as in java( addbatch, executebatch),

I have read somewhere I can put autocommit off before loop and commit after loop,

set autocommit off;
for loop
update query
end
commit;

so whole record will be update after loop, which is efficient, but could not able to implement that
HI GAMINI

please read this, hope you would get my requirement

update table_name set value = 'x' where id=1;
update table_name set value = 'xx' where id=2;
update table_ name set value = 'xxx' where id=3;
update table_ name set value = 'xxxx' where id=4;
update table_name set value = 'xxxxx' where id=5;
update table_name set value = 'xxxxxx' where id=6;

I have to do hundred of records , so I want to do it in a batch

GAMINI,

I have written a STORE PROC having a loop,

so I have to update records in loop, but it will update one by one in loop, which is not efficient,
so I want to do in a batch,

AKHILESH

It is not necessary to be between 1 and 6,
it could be any id and i need to hundred of different records
and value which I have to set that is also different,
hope you got
hi avi and alkesh

suppose I have to update following rows of a table, I want to do it in a single batch, because I have to do hundred of records

update table_name set value = 'x' where id=1;
update table_name set value = 'xx' where id=2;
update table_ name set value = 'xxx' where id=3;
update table_ name set value = 'xxxx' where id=4;
update table_name set value = 'xxxxx' where id=5;
update table_name set value = 'xxxxxx' where id=6;

i hope you got my problem
hi Bear Bibeault ,

I know this is not a JAVA question, but I thought any of rancher must know this thing,
So I put this.
hi akhilesh,

you can tell me in postgresql, if you know otherwise sql is also fine
In java when we need to do multiple rows update in a table,
we use batch functionality

I want to do this in data base in a store procedure,

anyone have some idea how to do this in sql or postgresql

please help, thanks in advance
you can go for kathy sierra scjp book, it has good content which helps you in test.
you can evaluate your performance by taking some online mock tests.
here are some useful links:

http://www.brainbench.com
http://www.skillsign.com

good luck

you can go for Head First or A Pressman book
12 years ago
Box mybox = new Box();

in your example mybox is not object, it is reference of the object which is created by (new Box();)
means mybox is holding bits internally which point to the object,

and gc is the process of cleaning the object from memory which are not used longer,
e.g.
String s1 ="Abc"
s1 = "xyz;

after line 2 the object which is created internally as new String("Abc")
will not have any live reference so it will available for garbage collection, because s1 is now holding the object new String("xyz")

12 years ago
yes firstly you should go through the book mention above, after that for some online mock test,
providing you some useful link, but try only after reading book for some days.

http://www.scjptest.com
http://www.skillsign.com
http://www.brainbench.com
In case of overriding child class method can not throws wider exception than parent class method in case of checked exception,
but in case of Runtime exception there i no such restriction,
you are throwing Exception in child class and this dose not come under Runtime
so it will not work