我的第一个job

declare
job9 number;
begin
dbms_job.submit(job9,'agnygl.pro9;',trunc(last_day(sysdate), 'dd'),'trunc(last_day(add_months(sysdate,1))) ');
commit;
end;

我的第一个存储过程(嵌套游标)

create or replace procedure pro9 as
first_count number(1, 0);
ccjdbh varchar2(11);
CURSOR cur_cjdbh IS
select cjdbh from b_index;
begin
insert into tnnew/*临时表,用于存放初步查询结果*/
(select cjdbh, yg, cjsj
from t_mid
where cjdbh in (select cjdbh from b_index)
and cjsj between trunc(last_day(sysdate), 'dd') - 1 and
trunc(last_day(sysdate), 'dd') - 1 + 1 / 24);
begin
open cur_cjdbh;
loop
fetch cur_cjdbh into ccjdbh;
exit when cur_cjdbh%notfound;
select count(*)
into first_count
from tnnew
where cjdbh = '' || ccjdbh;
if first_count = 0 then
update nnew n set n.cjdbh = ''||ccjdbh, n.yg = 0;/*结果表,用于存放最终查询结果*/
commit;
else
update nnew
set (cjdbh, YG,cjsj) = (select cjdbh, YG ,cjsj
from tnnew
where cjsj =
(select min(cjsj)
from tnnew
where cjdbh = ''||ccjdbh)
and cjdbh = ''||ccjdbh);
commit;
end if;
end loop;
close cur_cjdbh;
end;
end;

基于C#语言的CL2005点阵屏Demo

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
//步骤一:通讯初始化,调用ComInitial、NetInitial或ModemInitial;
//步骤二:控制卡特性设置,调用SetLEDProperty;
//步骤三:数据收发,调用数据收发函数;
//步骤四:关闭通讯,调用Close。
namespace LedDemo
{
public partial class LedForm : Form
{
public LedForm()
{
InitializeComponent();
}
//串口初始化
[DllImport("CL2005_API_StdCall.dll")]
public static extern bool CL2005_ComInitial(short ComPort, long BaudRate, short WaitTime);

//设置主控卡
[DllImport("CL2005_API_StdCall.dll")]
public static extern bool CL2005_SetLEDProperty(short CardType, short CardNum, short Width, short Height, short Color, short LockHZLibFlag);

//转换显示区
[DllImport("CL2005_API_StdCall.dll")]
public static extern bool CL2005_SwitchToBank(int bank);
[DllImport("CL2005_API_StdCall.dll")]
public static extern bool CL2005_ClearBank(int bank);
//显示字符串
[DllImport("CL2005_API_StdCall.dll")]
public static extern bool CL2005_ShowString(short bank, short XPos, short YPos, short Color, string lpString);//最后一个参数类型原本是long,我自行修改成了string,是造成不显示的原因吗?
//关闭串口
[DllImport("CL2005_API_StdCall.dll")]
public static extern void CL2005_ComClose();
//发送汉字的时候需要加载字库吗?
private void ShowLed_Click(object sender, EventArgs e)
{
Led("车:鲁A12345重:1000KG皮");
}
public bool Led(string strShow)
{
if (CL2005_ComInitial(5, 38400, 1000))
{
if (CL2005_SetLEDProperty(2, 0, 96, 32, 0, 1))
{
if (CL2005_SwitchToBank(0))
{
CL2005_ClearBank(0);
if (CL2005_ShowString(1, 0, 0, 1, strShow))
{
bool isOK = CL2005_SwitchToBank(1);
CL2005_ComClose();
if (isOK)
{
MessageBox.Show("显示成功");
}
else
{
MessageBox.Show("显示失败");
}
}
}
}
return true;
}
else
{
MessageBox.Show("LED串口初始化错误!");
return false;
}
}
}
}
leddemo.rar

Windows/Linux平台爬虫框架Scrapy的安装使用

经过3天的时间,总算运行起来了第一个基于Scrpy的爬虫。

1、首先我是在Windows平台下安装的Scrapy,装好以后死活不能用,关于这个框架的资料也非常少,冒失需要安装很多组件才能支持。白白耗费了我一天的时间最好以失败告终。

2、第二天安装了一个VMWare7.1,并汉化注册了一番,在其上安装了Ubuntu 10.10桌面版,VMWare7.1版本升级了一个easy install功能,造成了我安装的Ubuntu是英文版,同时没有进去桌面。经过一番挣扎重新安装了Ubuntu,使其可以正常工作。由于Ubuntu 本身自带Python,所以不用安装,开始安装Scrapy,Ubuntu自带了一个Ubuntu软件中心,我就直接安装了Scrapy,结果不能用,我反反复复查找了安装资料还是未能解决问题。

阅读全文

复杂的跨多个表查询

select a.Id as tId,a.RemainQuan as tRemainQuan,a.Ts as tTs,(CASE when a.BusiType='00' then '先款后货' else '先货后款' end) as BusiType,b.Name as coalName,c.Name as sendName,d.Name as receiveName from LcLocalNotic a join BdCoal b on a.CoalId=b.Id join BdMine c on a.MineId=c.Id join BdCustomer d on a.ConsigneeId=d.Id where a.Id='1001140100000002121';