I have some problems on MS SQL procedure convert to PostgreSQL PL/pgsql function. Please give me some advice. Can I
dynmaicdeclare cursor out of DECLARATION block and in STATEMENTS BLOCK?
I have many procedure in MS SQL which run dynmaic SQL Example:
if (UPPER(@DBTableName) = 'OT_APPLNCUSTOMER' or UPPER(@DBTableName) = 'OT_APPLTADDRTBL' )
begin
Set @SQLStm = 'Declare Cur_Temp_Attribute Cursor ' +
'For select ' + @DBTableField + ' From ' +
@DBTableName +
' Where APPln_Ref_No = ' + '''' + @Appln_Ref_No + ''''
end
else
begin
Set @SQLStm = 'Declare Cur_Temp_Attribute Cursor ' +
'For select ' + @DBTableField + ' From ' +
@DBTableName +
' Where identity_no = ' + '''' + @identity_no + ''''
end
exec(@SQLstm)
Open Cur_Temp_Attribute
------
Thank you very much.