| From: | "annachau" <annachau(at)hongkong(dot)com> |
|---|---|
| To: | "pgsql-general(at)postgresql(dot)org " <pgsql-general(at)postgresql(dot)org> |
| Subject: | Convert Dynmaic SQL from MS SQL procedure to PostgreSQL PL/pgsql function |
| Date: | 2002-11-21 15:58:27 |
| Message-ID: | 1037894307.10065.annachau@hongkong.com |
| Views: | Whole Thread | Raw Message | 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 | Tony Grant | 2002-11-21 16:36:50 | test |
| Previous Message | QUINN, JAY (SBCSI) | 2002-11-21 15:47:31 | Re: Dumb Newbie Question - Mandrake 9.0 / PGSQL 7.2 |