Convert Dynmaic SQL from MS SQL procedure to PostgreSQL PL/pgsql function

Поиск
Список
Период
Сортировка
От annachau
Тема Convert Dynmaic SQL from MS SQL procedure to PostgreSQL PL/pgsql function
Дата
Msg-id 1037894307.10065.annachau@hongkong.com
обсуждение исходный текст
Список pgsql-general
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.

В списке pgsql-general по дате отправления:

Предыдущее
От: "Mihai Gheorghiu"
Дата:
Сообщение: Migrating data from MSAccess
Следующее
От: "Ron St.Pierre"
Дата:
Сообщение: 7.3RC1 ?? Re: PostgreSQL compilation with custom table name length