How do I incorporate IF THEN ELSE in SQL*Plus? I searched online a bit, and saw reference to using BEGIN/END; around the code to do this. I tried simply declaring a variable at the beginning and putting a BEGIN/END; around the whole thing before the EXIT; to see what happened, and it appeared to just hang somewhere.
Basically, what I want to do is:
bunch of selects..
SELECT group1 FROM report_variations, current_variation where report_variation = rpt_variation.report_varia
tion
IF report_variations.group1 = 'COUNTRY'
CREATE TABLE table2 AS SELECT blah blah blah
ELSE
CREATE TABLE table2 AS SELECT la la la
ENDIF
bunch more selects...
EXIT;
Start Free Trial