If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
script for inserting a value into the table repeatedly
hi all,
i would like to insert a single value into a table repeatedly.
can any one please tell me how to write a shell script for inserting a same value into a table repeatedly.
example:
insert into test.temporary (usagedate) values ('2006-05-22');
actually there is another coloumn customerid which is a
GENERATED ALWAYS AS IDENTITY along with USAGEDATE
this value 2006-05-22 should be inserted repeatedly into the table temporary.
i think we have to use a loop in the script but i have no idea of using a loop in the shell script.
Say, if you want to insert this value 100 times, you can do
insert into t(usagedate)
with temp(a,b) as
(
values(1,current date)
union all
select a+1,current date from temp where a<100
)
select b as usagedate from temp
HTH
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.