create or replace procedure getMyLost(
season in number,--测试用
season_episode out varchar --最终返回结果
)
is
--演示游标的使用
cursor lost_cus is
select season,episode,to_char(watched_date,'yyyy-mm-dd hh24:mi:ss') watched_date from lost_already order by season,episode;
season_temp number(1);--随机得出的季
season_sql varchar2(100);--随机得出季的SQL
episode_sql varchar2(100);--得出季的集
episode_temp number(2);--得出季的集的SQL
watched boolean;--有看的控制条件
checkSQL varchar2(200);--检查是否已经看了的SQL
checkCount number(1);
recodeSQL varchar2(200);--记录当前得到的季和集
episodeSum number(2);--被选中季的总集数
begin
watched:=true;
season_sql:='select trunc(dbms_random.value*6)+1 from dual';
for lost in lost_cus
loop
dbms_output.put_line(lost.season||'==>'||lost.episode||'==>'||lost.watched_date);
end loop;
while watched
loop
execute immediate season_sql into season_temp;
episode_sql:='select t.episodesum from lost_season_episode t where t.season = '||season_temp;
execute immediate episode_sql into episodeSum;
execute immediate 'select trunc(dbms_random.value*'||episodeSum||')+1 from dual ' into episode_temp;
checkSQL:='select count(*) from lost_already t where t.season ='||season_temp||' and t.episode = '||episode_temp;
execute immediate checkSQL into checkCount;
if checkCount > 0 then
watched:=true;
else
watched:=false;
end if;
end loop;
recodeSQL:='insert into lost_already(season,episode,watched_date) values ('||season_temp||','||episode_temp||',sysdate)';
execute immediate recodeSQL;
commit;
season_episode:='第'||season_temp||'集 第'||episode_temp||'集';
判断是否存在表的函数:
create or replace function existtable(
tableName varchar2
) return varchar2
is
sqlText varchar2(200);
begin
sqlText:='select * from '||tableName;
execute immediate sqlText;
return 'exists';
exception
when others then return 'not exists';
end;
分享到:
相关推荐
Lost
logistic回归的损失函数和极大似然估计的关系 记 Φ(x)=11+e−θx \Phi(x)=\frac{1}{1+e^-{\theta x}} Φ(x)=1+e−θx1 我们可以把这个sigmoid函数的值看做y等于1的后验估计概率,也就是: p(y=1∣x)=Φ(x) p(y=1|...
% Y = IM2JPEG(X, QUALITY) compresses image X based on 8 x 8 DCT % transforms, coefficient quantization, and Huffman ...% is lost and compression achieved. Y is an encoding structure % containing fields:
the lost symbol pdf the lost symbol pdf
我学习了NIOS_II,整理出他的常用指令以及常用函数,以及个人的一点学习心得,欢迎大家下载
Lost Location Open Source Tracker (for Android) Usage This project seeks to provide an open source alternative to the Google Play services location APIs that depends only on the Android SDK. It ...
The Lost Symbol - Dan Brown.pdf The Lost Symbol - Dan Brown.pdf
Lost-my-mind
基本上你能想的版本都有破解,只使用过EXCEL里的破解,另外的各位朋友自己可以试下
jobs-lost-jobs-gained-full-report.pdf
基于bmob的开发,失物招领管里系统,只有添加和查询,灭有修改和删除
PJBlog3 Lost模板
PJBlog2 Lost Dark
LOST具有灵活性,因为它允许运行用户定义的注释管道,在其中可以将不同的注释接口/工具和算法组合在一个过程中。 它是基于Web的,因为在浏览器中可以看到整个注释过程。 您可以在本地计算机上使用docker快速设置...
《概率论基础和随机过程》电子书,还不错!!!!
LOST.DIR文件夹中意外丢失文件的恢复方法
魔镜补丁,稳定运行,可实施产出emoji表情包
Updates CNG estimate, and applies the CNG when packet was lost.
Arthur_Conan_Doyle_-_The_Lost_World Arthur_Conan_Doyle_-_The_Lost_World
lost