a problem when poring from Oracle's PL/SQL to PLPGSQL

Поиск
Список
Период
Сортировка
От billy
Тема a problem when poring from Oracle's PL/SQL to PLPGSQL
Дата
Msg-id 48523283.014507.00758@m5-81.163.com
обсуждение исходный текст
Ответы Re: a problem when poring from Oracle's PL/SQL to PLPGSQL  (Mario Weilguni <mweilguni@sime.com>)
Список pgsql-hackers
pgsql-hackers:

The following is Oracle's PL/SQL
 if resTypeTableName is nullthen                                                               queryStr := 'select
IntIID,Path FROM aaResourceData' || ' where ResType=''' || srcType || ''' and ResID=''' || srcID || '''';
                                                else
                                                     queryStr := 'select IntIID, Path FROM ' || resTypeTableName || '
whereResType=''' || srcType || ''' and ResID=''' ||                           srcID || '''';
       end if;                                                         
open cursorSrc for queryStr;


Here queryStr is a variable which type is TEXT OR VARCHAR or other string types.

But in  PLPGSQL, we can only open a cursor this way:
    open cursorSrc for select * from testtable;

We cannot substitude "select * from testtable" with a variable.

Is there another way to handle it?

Thank you for your help. :-)


        billy
        billywq@163.com
          2008-06-13





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

Предыдущее
От: ITAGAKI Takahiro
Дата:
Сообщение: pg_stat_statements
Следующее
От: Mario Weilguni
Дата:
Сообщение: Re: a problem when poring from Oracle's PL/SQL to PLPGSQL