Home > database >  Pb data window data source with oracle stored procedures return values stored procedure how to write
Pb data window data source with oracle stored procedures return values stored procedure how to write

Time:10-05

Originally I use is essentially a database, if do the report data are usually in the SQL stored procedure is finished and then select * from table return to pb data window, but now with oracle, so I write the return value of the stored procedure grammar by oracle! The following is the SQL, can directly in the stored procedure returns a data set, pb is the use of the stored procedure in the data source can be formed a report! Who can tell me something about how to realize the stored procedure returns in oracle data set!
CREATE PROCEDURE cw_ywhzb @ ldt_sdate datetime,
@ ldt_edate datetime,
@ ls_lx varchar (1)
AS
The BEGIN


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- classification summary part -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
If @ ls_lx='1'
The begin
SELECT (SELECT fymc from jc_fylbzd where fybh=jc_fyzd. Lsfybh) as fymc,
The sum (zje) as je
The FROM jc_fylbzd,
Jc_fyzd,
Mz_fpdj,
Mz_cfmx
The WHERE (mz_fpdj. FPH=mz_cfmx. FPH) and
(jc_fylbzd. Fybh=mz_cfmx. Fygl) and
(jc_fylbzd. Fybh=jc_fyzd. Fybh) and
((jc_fyzd LBBH='1') and
(SFSJ & gt;=@ ldt_sdate and
SFSJ & lt;=@ ldt_edate))
GROUP BY jc_fyzd. Lsfybh
Return
End

If @ ls_lx='2'
The begin
SELECT (SELECT fymc from jc_fylbzd where fybh=jc_fyzd. Lsfybh) as fymc,
The sum (zje) as je
The FROM jc_fylbzd,
Jc_fyzd,
Zy_cfdj,
Zy_cfmx
The WHERE (zy_cfdj. CFH=zy_cfmx. CFH) and
(jc_fylbzd. Fybh=zy_cfmx. Fygl) and
(jc_fylbzd. Fybh=jc_fyzd. Fybh) and
((jc_fyzd LBBH='2') and
(HJSJ & gt;=@ ldt_sdate and
HJSJ & lt;=@ ldt_edate))
GROUP BY jc_fyzd. Lsfybh
Return
End

Return
END

GO

CodePudding user response:

Pick up points first!

CodePudding user response:

Pay attention to pick up points
  • Related