how use procedure with sybase database?
来源:互联网 发布:天刀捏脸数据男钟汉良 编辑:程序博客网 时间:2024/06/05 19:19
how use procedure with sybase database?
author:chinayaosir
blog:http://blog.csdn.net/chinayaosir
1.auto create a question ?
when user delete /insert data in o_factoryqty,
then total rows of i_ftyandpric <> o_factoryqty by one oc_number?
table-name:i_ftyandpric,primary key:oc_number,itemnumber,shipp_date,factory_id
table-name:o_factoryqty,primary key:oc_number,itemnumber,shipp_date,factory_id
2. sql code test in sybase database
select oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id
from i_ftyandpric
where oc_number like "M05MB0%"
and
oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id not in
(
select oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id
from o_factoryqty
where oc_number like "M05MB0%"
)
the data of sql run value,pls see below
M05MB018BY35343 11/12/04 HUA LONG/H
M05MB029BY35662 11/13/04 YUNGFENG/C
M05MB029BY35664 11/13/04 YUNGFENG/C
M05MB036BY34949 12/31/04 FOREVER/H
M05MB055BY35483 11/05/04 NEW IDEA/H
M05MB055BY35649 11/05/04 NEW IDEA/H
M05MB055BY35650 11/05/04 NEW IDEA/H
M05MB056BV30495 11/05/04 NEW IDEA/H
M05MB057BY35649 11/17/04 NEW IDEA/H
M05MB057BY35650 11/17/04 NEW IDEA/H
M05MB058BY35052 11/19/04 NEW IDEA/H
M05MB059BY35391 11/21/04 NEW IDEA/H
M05MB061BY34789 11/20/04 NEW IDEA/H
M05MB071BY34084 11/22/04 NEW IDEA/H
3.//define procedure
//create procedure with powerbuilder
//clear data with check_i_ftyandpric_data procedure
create procedure check_i_ftyandpric_data(
@oc_number char(8),
@result char(1) output
)
as
select @result='1'
begin
delete from i_ftyandpric
where oc_number =@oc_number
and oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id
not in(
select oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id
from o_factoryqty
where oc_number = @oc_number
)
select @result='0'
end
4.run procedure
//when clicked a save button,then call code with powerbuilder.
string chk_oc,ls_code
chk_oc=trim(sle_1.text)
DECLARE b_i_ftyandprice_ck PROCEDURE FOR dbo.check_i_ftyandpric_data
@oc_number = :chk_oc,
@result = :ls_code OUTPUT;
execute b_i_ftyandprice_ck;
fetch b_i_ftyandprice_ck into :ls_code;
close b_i_ftyandprice_ck;
commit;
if ls_code<>'0' then
messagebox('Warning!','delete data Error !')
end if
author:chinayaosir
blog:http://blog.csdn.net/chinayaosir
1.auto create a question ?
when user delete /insert data in o_factoryqty,
then total rows of i_ftyandpric <> o_factoryqty by one oc_number?
table-name:i_ftyandpric,primary key:oc_number,itemnumber,shipp_date,factory_id
table-name:o_factoryqty,primary key:oc_number,itemnumber,shipp_date,factory_id
2. sql code test in sybase database
select oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id
from i_ftyandpric
where oc_number like "M05MB0%"
and
oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id not in
(
select oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id
from o_factoryqty
where oc_number like "M05MB0%"
)
the data of sql run value,pls see below
M05MB018BY35343 11/12/04 HUA LONG/H
M05MB029BY35662 11/13/04 YUNGFENG/C
M05MB029BY35664 11/13/04 YUNGFENG/C
M05MB036BY34949 12/31/04 FOREVER/H
M05MB055BY35483 11/05/04 NEW IDEA/H
M05MB055BY35649 11/05/04 NEW IDEA/H
M05MB055BY35650 11/05/04 NEW IDEA/H
M05MB056BV30495 11/05/04 NEW IDEA/H
M05MB057BY35649 11/17/04 NEW IDEA/H
M05MB057BY35650 11/17/04 NEW IDEA/H
M05MB058BY35052 11/19/04 NEW IDEA/H
M05MB059BY35391 11/21/04 NEW IDEA/H
M05MB061BY34789 11/20/04 NEW IDEA/H
M05MB071BY34084 11/22/04 NEW IDEA/H
3.//define procedure
//create procedure with powerbuilder
//clear data with check_i_ftyandpric_data procedure
create procedure check_i_ftyandpric_data(
@oc_number char(8),
@result char(1) output
)
as
select @result='1'
begin
delete from i_ftyandpric
where oc_number =@oc_number
and oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id
not in(
select oc_number+itemnumber+convert(char(14),shipp_date,1)+factory_id
from o_factoryqty
where oc_number = @oc_number
)
select @result='0'
end
4.run procedure
//when clicked a save button,then call code with powerbuilder.
string chk_oc,ls_code
chk_oc=trim(sle_1.text)
DECLARE b_i_ftyandprice_ck PROCEDURE FOR dbo.check_i_ftyandpric_data
@oc_number = :chk_oc,
@result = :ls_code OUTPUT;
execute b_i_ftyandprice_ck;
fetch b_i_ftyandprice_ck into :ls_code;
close b_i_ftyandprice_ck;
commit;
if ls_code<>'0' then
messagebox('Warning!','delete data Error !')
end if
- how use procedure with sybase database?
- How to Use Procedure
- MYBATIS use procedure(oracle database)
- How to use a SQL Server database with your PHP web site
- Sybase 代替start with、connect by的store procedure
- how to use a SQLite database in a standalone program with an HTML interface and VBScript as the programming language
- [Sybase] Stored procedure tips
- How To Use Linux epoll with Python
- How to use Trace2UML together with Doxygen
- How To Use Linux epoll with Python
- How to use Blocks with iOS
- how to use linux epoll with c
- How to use Django with uWSGI
- How to use passwords securely with wget
- How To Use Linux epoll with Python
- How to use http cookies with Qt
- how to use Wordnet with Java?
- How to use Django with mod_wsgi.
- 用TCP连接分析TUXEDO的WS模式
- 激发情境潜能
- 写出漂亮代码的七种方法
- C#锁定EXCEL工作表
- Delphi 常用文档资料之一Paradox数据类型和长度表
- how use procedure with sybase database?
- flash和javascript之间的通讯
- phplib template中文教程
- 为什么要用大写的那些类型修饰符?如INT与int、BOOL与bool、UINT等...
- jquery 学习资料
- 特殊的数组赋值
- 管理信息系统需求调研分析指南
- web.xml配置文件祥解
- 控件的颜色设置(本景色,文本色,文本背景色)