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

From: "billy" <billywq(at)163(dot)com>
To: pgsql-hackers(at)postgresql(dot)org <pgsql-hackers(at)postgresql(dot)org>
Subject: a problem when poring from Oracle's PL/SQL to PLPGSQL
Date: 2008-06-13 08:39:59
Message-ID: 48523283.014507.00758@m5-81.163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pgsql-hackers:

The following is Oracle's PL/SQL

if resTypeTableName is null
then
queryStr := 'select IntIID, Path FROM aaResourceData' || ' where ResType=''' || srcType || ''' and ResID=''' || srcID || '''';
else queryStr := 'select IntIID, Path FROM ' || resTypeTableName || ' where ResType=''' || 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(at)163(dot)com
          2008-06-13

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mario Weilguni 2008-06-13 09:03:58 Re: a problem when poring from Oracle's PL/SQL to PLPGSQL
Previous Message ITAGAKI Takahiro 2008-06-13 08:33:18 pg_stat_statements