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

From: Mario Weilguni <mweilguni(at)sime(dot)com>
To: billy <billywq(at)163(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: a problem when poring from Oracle's PL/SQL to PLPGSQL
Date: 2008-06-13 09:03:58
Message-ID: 485237FE.50403@sime.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

billy schrieb:
> 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. :-)
>
open cursorSrc for execute queryStr; should work fine

Regards
Mario Weilguni

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2008-06-13 09:26:07 Re: Proposal: Multiversion page api (inplace upgrade)
Previous Message billy 2008-06-13 08:39:59 a problem when poring from Oracle's PL/SQL to PLPGSQL