-- utils.sql
-- Suppress SQL*Plus substitution prompts
SET VERIFY OFF
SET FEEDBACK OFF
SET HEADING OFF
SET TERMOUT ON
-- Capture argument
DEFINE arg1 = NVL('&1','')
-- Exit immediately if not 'Y'
COLUMN dummy NEW_VALUE dummy
SELECT CASE
WHEN UPPER(TRIM('&arg1')) = 'Y' THEN 'RUN'
ELSE 'EXIT'
END AS dummy
FROM dual;
-- Conditional execution
-- Use SQL*Plus scripting control
-- If dummy=EXIT, exit
-- Otherwise continue
-- Trick: use WHENEVER SQLERROR to exit
DEFINE dummy = '&dummy'
COLUMN skip_exit NEW_VALUE skip_exit
SELECT '&dummy' AS skip_exit FROM dual;
-- Exit if needed
BEGIN
IF '&skip_exit' = 'EXIT' THEN
RAISE_APPLICATION_ERROR(-20001,'Exiting per user request');
END IF;
END;
/
-- Place your main script logic here
PROMPT Running utils.sql...
-- ... rest of your script ...
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)