I was wondering if it is possible to have multiple SQL select statements within an if statement using PL/SQL. I wanted different select statements based on the value of another field.
This is what I tried so far but I'm stuck and can't go on
BEGIN
IF
:P3_COMPAREWITH <> 'OTHER TABLES'
THEN
SELECT TABLE_NAME AS TARGET, TABLE_NAME AS TARGETTABLE
FROM [email protected]
WHERE OWNER = 'TOSAD_2017_2D_TEAM4_TARGET';
ELSIF
:P3_COMPAREWITH = 'OTHER TABLES'
THEN
SELECT TABLE_NAME AS TARGET, TABLE_NAME AS TARGETTABLE
FROM [email protected]
WHERE OWNER = 'TOSAD_2017_2D_TEAM4_TARGET' AND TABLE_NAME <> :P3_TARGETTABLE;
END IF;
END;
If someone could help me out, thanks in advance.
selectstatement in PL/SQL is meaningless. You need to define where you want to put selected data, and there are a lot of possibilities (variables, records, collections, cursors...) for this. So tell us what do you want to do with selected data.