1.查询语句
带参数的oracle数据库查询,写在存储过程中:
create PROCEDURE spd_pyitf_his_in
@group_no varchar(12),
@status varchar(1),
@flag varchar(20)
AS
DECLARE @Sql VARCHAR(1000)
BEGIN
set @Sql = 'select distinct in_docu_no from spd.pyitf_his_in where group_no='+ @group_no+'and load_status='+ @status
SET @Sql = 'SELECT * FROM OPENQUERY(SPD, ''' + REPLACE(@Sql, '''', '''''') + ''')'
EXEC(@Sql)
END
2.update
带参数的存储过程:
create
PROCEDURE spd_pyitf_his_in_update
@group_no varchar(12),
@status varchar(1),
@flag varchar(20),
@in_docu_no varchar(20)
AS
DECLARE @Sql VARCHAR(1000)
BEGIN
update OPENQUERY(SPD,'select * from spd.pyitf_his_in' ) set LOAD_STATUS='1' WHERE GROUP_NO= @group_no and LOAD_STATUS= @status and IN_DOCU_NO=@in_docu_no
END