From postgresql-general Fri Jun 13 09:03:58 2008 From: Mario Weilguni Date: Fri, 13 Jun 2008 09:03:58 +0000 To: postgresql-general Subject: Re: [HACKERS] a problem when poring from Oracle's PL/SQL to PLPGSQL Message-Id: <485237FE.50403 () sime ! com> X-MARC-Message: https://marc.info/?l=postgresql-general&m=121334793415291 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers