From: | "annachau" <annachau(at)hongkong(dot)com> |
---|---|
To: | "" <pgsql-general(at)postgresql(dot)org> |
Subject: | Convert Dynmaic SQL from MS SQL procedure to PostgreSQL PL/pgsql function |
Date: | 2002-11-25 07:47:24 |
Message-ID: | 1038210444.279.annachau@hongkong.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have some problems on MS SQL procedure convert to PostgreSQL PL/pgsql function. Please give me some advice. Can I dynmaic declare 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-11-25 07:52:37 | Re: Calculated fileds in pg |
Previous Message | annachau | 2002-11-25 07:44:45 | Please Help on MS SQL7.0 Procedure to PostgreSQL |