void NextDate(void)
{
int year,mouth,day
int year1,mouth1,day1
int run=0
while(1)
{
scanf("%d",&year)
if(year>2050||year<1920)
{
printf("您输入的年份超出范围,请重新输入\n")
continue
}
if((year%4==0&&year%400!=0)||year%400==0)
run=1
else
run=0
break
}
while(1)
{ printf("请输入月份\n")
scanf("%d",&mouth)
if(mouth>12||mouth<1)
{
printf("您输入的月份超出范围,请重新输入\n")
continue
}
break
}
while(1)
{
printf("请输入日期\n")
scanf("%d",&day)
if(day>31||day<1)
{
printf("%d月份没有%d天,请重新输入\n",mouth,day)
continue
}
if(day==31&&(mouth==2||mouth==4||mouth==6||mouth==9||mouth==11))
{
printf("%d月份没有31天,请重新输入\n",mouth)
continue
}
if(day==30&&mouth==2)
{
printf("2月份没有30天,请重新输入\n")
continue
}
if(day==29&&run==0&&mouth==2)
{
printf("%d年份2月没有%d天,请重新输入\n",year,day)
continue
}
break
}
if (day==31||(day==30&&(mouth==4||mouth==6||mouth==9||mouth==11)))
{
if(mouth==12)
{
mouth1=1
year1=year+1
day1=1
}
else
{
mouth1=mouth+1
year1=year
day1=1
}
}
else if((day==29&&mouth==2)||(day==28&&mouth==2&&run==0))
{
mouth1=3
year1=year
day1=1
}
else
{
mouth1=mouth
day1=day+1
year1=year
}
printf("您输入的是%d年%d月%d日\n",year,mouth,day)
printf("它的下一天是%d年%d月%d日\n",year1,mouth1,day1)
}
int main(void)
{
NextDate()
}
1、把init.ora中如下两个参数打开
JOB_QUEUE_INTERVAL=60
JOB_QUEUE_PROCESSES=4
job_queue_keep_connections=true
然后重启一个库,如果原来已经打开了则不用这步了
2、示例,以下由sqlplus 来执行,具体参照一下相关的文档
VARIABLE jobno number
BEGIN
DBMS_JOB.SUBMIT(:jobno,
’p_test’
SYSDATE,’SYSDATE + 1/72’)
commit
END
DBMS_JOB.SUBMIT(:jobno,//job号
’your_procedure’,//要执行的过程
trunc(sysdate)+1/24,//下次执行时间
’trunc(sysdate)+1/24+1’//每次间隔时间
)
删除job:dbms_job.remove(jobno)
修改job:dbms_job.what(jobno,what)
修改下次执行时间:dbms_job.next_date(job,next_date)
修改间隔时间:dbms_job.interval(job,interval)
停止job:dbms.broken(job,broken,nextdate)
启动job:dbms_job.run(jobno)
例子:
VARIABLE jobno number
begin
DBMS_JOB.SUBMIT(:jobno,
’Procdemo’,
SYSDATE, ’SYSDATE + 1/720’)
commit
end
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)