技术开发 频道

基于DM数据库的Power Builder程序开发

  4.PB中对存储过程的使用

  以关键字RPCFUNC声明存储过程

  (1) 在前台要申明一个事务(transact)的用户对象,比方说:u_trans

  (2) 然后用u_trans取代默认的transact

  (3) 然后将你要使用的存储过程作为外部的函数引进来

  以下为使用PB调用DM中的存储过程的示例(针对DM的几种存储过程分类,分为输入参数过程、输出参数过程、输入输出参数过程):

  DM中执行建表和存储过程语句:

  --建表

  create table pbdm (a bigint,b binary,c bit,d blob,e char,f clob,g date,h decimal,i double,j float,k integer,l smallint,m time,n timestamp,o tinyint,p varbinary,q varchar);

  --输入参数过程

  create or replace procedure proc_in (b binary,c bit,d blob,e char,f clob,g date,h decimal,i double,j float,k integer,l smallint,m time,n timestamp,o tinyint,p varbinary,q varchar)
  
as
  
temp integer;
  
begin
  
select isnull(max(a),0) into temp from pbdm;
  
temp:=temp+1
  
insert into pbdm values (temp,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q);
  
end;

  --输出参数过程

  create or replace procedure proc_out(a1 in int , b1 out binary , c1 out bit , d1 out blob , e1 out char , f1 out clob , g1 out date , h1 out decimal
  , i1 out
double , j1 out float , k1 out integer , l1 out smallint , m1 out time , n1 out timestamp , o1 out
  
tinyint , p1 out varbinary , q1 out varchar )
  
as
  
temp integer ;
  
begin
  
select b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q into b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1 from pbdm where pbdm.a = a1 ;
  
print 'hi' ;
  
end

  --输入输出参数过程

  create or replace procedure proc_inout(a1 in out int , b1 in out binary , c1 in out bit , d1 in out blob , e1 in out char , f1 in out clob , g1 in out date , h1 in out decimal
  , i1
in out double , j1 in out float , k1 in out integer , l1 in out smallint , m1 in out time , n1 in out timestamp , o1 in out
tinyint , p1 in out varbinary , q1 in out varchar )
  
as
  
temp integer ;
  
begin
  
select b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q into b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1 from pbdm where pbdm.a = a1 ;
  
print 'hi' ;
  
end
0
相关文章