2008年8月25日星期一

oracle 处理select into 异常

select into 会引发两个异常

NO_DATA_FOUND 和 TOO_MANY_ROWS

在没有过多选择余地的情况下可以使用

begin
SELECT t.fullname into FULLNAME FROM ssouser.DB_USR_OPERATOR t where t.username=LASTDDEALHANDLERNO;
Exception
when no_data_found then
FULLNAME := '';
end;

用一个语句块包住
另外用游标%notfound特性也可以解决.

oracle 异常处理

Exception
when no_data_found then
dbms_output.put_line('no data return'); --自己的处理语句
when others then
rollback;--自己的处理语句

oracle 关掉正在运行的过程

alter system kill session "sid,serial"

如何查SID 与SERIAL呢

select sid,serial# from v$session where username ='***';

select * from v$access t where t.OWNER='RPTDATA' and t.TYPE='PROCEDURE'

oracle 查看正在运行的存储过程

select * from v$db_object_cache where locks > 0 and pins > 0 and type='PROCEDURE';

oracle 游标使用 带参数

CURSOR myCursor(DISPACHNO DB_WFS_RPTWFSLIST1.Dispachno%type) is select t.starttime,t.depachdatefrom RPTDATA.DB_WFS_RPTWFSLIST1 twhere t.achivedate between to_date(iStartTime' 00:00:00','YYYY-MM-DD HH24:MI:SS') and to_date(iEndTime' 23:59:59', 'YYYY-MM-DD HH24:MI:SS')and t.dispachno = DISPACHNO;


loop fetch myCursor2 into DISPACHNO; exit when myCursor2%notfound; if myCursor%isopen = false then open myCursor(DISPACHNO); end if;
end loop;close myCursor;

oracle 游标使用

以LOOP的形式
CURSOR myCursor is select t.starttime,t.depachdate,t.dispachno from RPTDATA.DB_WFS_RPTWFSLIST1 twhere t.achivedate between iStartTime and iEndTimeand t.starttime is not nulland t.depachdate is not null;

if myCursor%isopen = false then open myCursor; end if; loop fetch myCursor into STARTTIME, DEPACHDATE, DISPACHNO; exit when myCursor%notfound; YWSC := (STARTTIME - DEPACHDATE) * 24; if YWSC > 4 then SUMYWSC := SUMYWSC + YWSC; YWCNT := YWCNT + 1; end if; end loop; close myCursor;

2008年8月24日星期日

oracle 时间操作 看星期

select to_char(sysdate,'day') from dual
星期一
select to_char(sysdate,'d') from dual
2
oracle一周是从周日开始计数的,这样的话要得今天是星期几的数字就用:
select to_char(sysdate-1,'d') from dual
1

2008年8月23日星期六

何苦去想

仿佛一阵风,带走一切本不属于自己的东西,那怕只是一个幻想。 失去的如此突然,如此心有不干。你的将近一年抵不过别人三天!只求自己别再这么傻天真下去,为了以后不再失去自己守护的东西,赶紧觉悟吧蠢蛋!

2008年8月21日星期四

Happy birthday my younger sister


Today is your birthday,I have just know it when you told me at this morning.


I think you will forgive me. ^_^


2008年8月20日星期三

Came to Guangzhou for more than a year(2)

Later, I work in trustel as a developer.Better say a factotum than a developer at the beginning.

It seem that many thing in my lives go by contrary,I try to work better but it goes more worse.

Maybe, I can't cooperate closely with the people who I worked together or it is due to poor management or there is no management.

In a word, I decided to resign.Go over the events of these days in my mind,I will think about them carefully.



Do it now , otherwise , it will be too late.

To me, learning English is essential, even if it is very difficult for me at this time.

来广州一年多(1)

去年6月28日,跟着几个大学同学坐着拥挤的火车来到了广州.

也不知道自己为什么要来广州,只是想着离家远点,给自己一种体验,那怕再难.

昨天看了同学的日志,回想起刚来广州时的那些事情还不免兴奋.

最快乐的时光莫过于八九个人在长BAN(打不出来)那段找工作的日子.

白天上午去菜市场投简历,下午回来在网吧打游戏,花半个小时在网上投简历.虽然偶尔

找不到工作的压力(经济危机)会在脑子里出现,但是人多就有人我的好处,相互聊聊就轻松多了.这可

能就是传说中的群体肓目性.

十来个人无论走到哪里都是那么地拉风,特别是在七月的广州,天所闷热,十来个光着上

上身的男人逛公园的样子更是有得一拼.

那也是一段最辛苦的日子,主要是太热了.我记得最惨的一次就是:刚刚从一个公司面试

回来马上到南方人才市场附近一个餐馆吃饭的情镜,喝的汤没有我流的汗多,感觉整个

人都要流干了.还好那天下午的面试让我找到了我的第一份工作.

找工作有很多事情让我记忆犹新,是通过一个猎头帮我找到的一家日企(可见我在网上做了多

少垃圾信息,现在明白垃圾邮件是怎么会事了.)问了一些基础的问题后,让我提些问题.我一想我当前

面对的主要问题就是温饱问题,于是我就问这个公司的伙食是怎么解决的.面试的人很正经慢速的答

道:我们是公司,不是工厂,就边他(旁边坐的一个小弟,从头到尾观察我,记笔记的一个)我们都不会包

伙食.言语中我感觉非常的BS我也.后来直到我刚刚签合同时才给我打来电话,我给挂掉了.后来想着

还稍微有点后悔,毕竟也是个不错的机会.

还有一次面试比较深刻的是当时一个大会议桌周转坐了很多人,一个个自我介绍一个个的问.我比较

靠后.一开始我就感觉不好,个个穿的周五正王,我穿个T恤.我认为我会比较紧张,这么多人.没想到没

有最紧张只有更紧张,有几位仁兄的回答让我都觉得有必要这么紧张吗?当然也有比较扯淡的,说了

一大堆废话的.也许是刚来广州,说话比较直也比较大胆,后来就发生了很多事情,待以后再说了.无论

如何,我对当处决定要我那人还是心存感激的,至少他认为我还行.只是后来,好像有很多事情都不在

我的控制之中,其中免不了我的很多错误和遗憾的地方.

以后再吹,上班时间就算闲,写BLOG也是不好的.待续...............

2008年8月19日星期二

你活着是为了什么,你现在又在做什么?

已经一年了.