我的sql server的存储过程代码是:
ALTER procedure [dbo].[MasterReport_SP]
(@masterReportRecNo bigint)
AS
DECLARE @updateDateCriteria varchar (500)
DECLARE @spCriteria varchar (3000)
DECLARE @sqlCommand1 varchar(3000)
DECLARE @sqlCommand2 varchar(3000)
DECLARE @sqlCommand3 varchar(3000)
DECLARE @transNo varchar (50)
BEGIN TRY
if @underwriterState = ''
begin
set @underwriterState = null
end
Set @totalEndtPremium = 0
Set @sqlCommand1 = ''
if @updateDateCriteria is NOT NULL
begin
if @underwriterState is NOT NULL
begin
Set @sqlCommand1 = 'DECLARE transDetails Cursor for Select policyNumber, policyTerm from trans'
end
else
begin
Set @sqlCommand1 = 'DECLARE transDetails Cursor for Select policyNumber, policyTerm, policyIssueDate from trans'
end
end
IF @sqlCommand1 is NOT NULL
BEGIN
EXEC (@sqlCommand1)
OPEN transDetails
FETCH NEXT FROM transDetails INTO @policyNumber, @policyTerm, @policyIssueDate, @transactionNo
WHILE @@FETCH_STATUS = 0
BEGIN
Print @policyNumber
Set @systemCalcPremium = 0
Set @premium = 0
end;
由于这条线,我面临问题: 设置@sqlCommand1 =' DECLARE transDetails Cursor for select policyNumber,policyTerm from trans' 。因为mysql不允许这样做。是否有任何替代此行MySQL的。