In order to bypass special characters:
IF :P123_CHOICE = 'EMP' THEN
RETURN
q'[select ... ]';
ELSE
RETURN
q'[ select ...]';
END IF;
Oracle® Database PL/SQL Language Reference 11g Release 1 (11.1)
Domanda
I am trying to build dynamic and conditional LOV on condition taken from the page item. I came across this example ...
IF :P123_CHOICE = 'EMP' THEN
RETURN
'SELECT ename d, empno r
FROM emp';
ELSE
RETURN
'SELECT dname d, deptno r
FROM dept';
END IF;
However I need something little bit more complicated:
IF :P123_CHOICE = 'EMP' THEN
RETURN
'SELECT ename||' : '||esurname d, empno r
FROM emp
WHERE (admin ='N' or ADMIN = 'Y')
';
ELSE
RETURN
'SELECT ename||' : '||esurname d, empno r
FROM emp
WHERE admin ='N'
';
END IF;
As a result I get errors:
*ORA-06550: line 3, column 21: PL/SQL: ORA-01756: quoted string not properly terminated ORA-01756: quoted string not properly terminated ORA-06550: line 1, column 13: PL/SQL: SQL Statement ignored ORA-06550: line 5, column 4: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ; ORA-01756: quoted string not properly terminated*
It is clearly formatting issue I cannot solve. Any help greatly appreciated.
Soluzione
In order to bypass special characters:
IF :P123_CHOICE = 'EMP' THEN
RETURN
q'[select ... ]';
ELSE
RETURN
q'[ select ...]';
END IF;
Oracle® Database PL/SQL Language Reference 11g Release 1 (11.1)