Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Execute Immediate : Can't run ...Please help
Error message would certainly help.
First thing I would guess is that you need double quotes around your variables like this:
strSql := strSql || ' WHERE SLOOKUP_GROUP = '''|| pSLOOKUP_GROUP ||''; strSql := strSql || ' AND ILOOKUP_LANGUAGECODE = ''' || pILOOKUP_LANGUAGECODE || '';
Second, why do you even need the EXECUTE IMMEDIATE? OPEN io_cursor FOR strSql will work just fine.
your reworked code:
AS
PROCEDURE GET_LOOKUP
(pILOOKUP_LANGUAGECODE IN NUMBER,
pSLOOKUP_GROUP IN VARCHAR2, IO_CURSOR IN OUT T_CURSOR)
DISTINCT LOOKUP.SLOOKUP_VALUE, LOOKUP.SLOOKUP_LABEL FROM SFIS.LOOKUP';
strSql := strSql || ' WHERE SLOOKUP_GROUP = ''' || pSLOOKUP_GROUP || '';
strSql := strSql || ' AND ILOOKUP_LANGUAGECODE = ''' || pILOOKUP_LANGUAGECODE || '';
IF (pSLOOKUP_GROUP='FacStatusEntryType') OR (pSLOOKUP_GROUP='FacOwner') THEN
OPEN IO_CURSOR FOR strSql := strSql || ' ORDER BY LOOKUP.SLOOKUP_VALUE'; ELSE OPEN IO_CURSOR FOR strSql;
chet Received on Fri Apr 22 2005 - 12:29:06 CDT