我想运行一个程序 exec remove_job_procedure' job_id' ,它接受一个job_id,从列表中删除作业。现在我有一个Select Job_id查询,它返回某些类型的多个作业。我可以编写另一个程序,它会在select job_id查询中有多次运行remove_job_procedure吗?
第一次查询:
第二次质疑:
我需要创建一个新程序,将第一个查询的作业ID逐个提供给第二个查询(程序)。
由于
答案 0 :(得分:0)
-
这是你需要的第一个声明我做了juste以获取日期到我的表中你已经有结果使用select语句插入表
resource "google_compute_firewall" "firewall" {
name = "test"
direction = "INGRESS"
allow {
protocol = "tcp"
ports = [5000, 5100]
}
allow {
protocol = "tcp"
ports = [6000, 6100]
}
allow {
protocol = "tcp"
ports = [7000, 7100]
}
}
测试结果我确实选择了名称,因为我没有商店程序
答案 1 :(得分:0)
如果你有很多JOB_ID CURSOR可能不是一个好主意,使用它将是长时间执行因为它将逐行执行但是如果你有超过10000 ID并且为了更好的性能使用批量处理这个:'还有很多方法可以执行proc'
DECLARE @PractitionerId varchar(50) , @count int , @first_insert int
declare @table table (id_job varchar(50))
declare @table2 table (id varchar(50))
insert into @table
select '1q2w3e' union
select '2w3e1q' union
select '2w3e4r' union
select 'toto'
/* You statement will start from here cause you already have the result id the job_id */
insert into @table2
select concat('remove_job_procedure',job_id) from job where job_type in 'job_type_1'
set @first_insert = 1
set @count = (select count(*) from @table2)
while @first_insert <= @count
BEGIN
set @PractitionerId = (select id from
(select row_number() over(order by id ) as rowcounts , id from @table2) d
where d.rowcounts = @first_insert)
--select @PractitionerId
exec @PractitionerId
set @first_insert = @first_insert+1
END