SQL Script won't run as sql statement in automation

I have some code that runs as a SQL script (QSR or SQL*Plus) but I need it to run as part of a SQL statement so I can load & use it in an automation.

Code:

col startval new_value v_startval

SELECT
NVL(MAX(masterid) + 1,1) startval
FROM
master_sales_data;

create sequence bookings_masterid start with &v_startval;

Any help would be appreciated. I tried using an anonymous block with a number variable and a select into, but I get an “invalid number” error.

You will need to do this in two steps. Create a variable activity and execute the SQL statement to set it’s value. Then execute the Creat sequence in a Select Data Activity. The replacement literal ‘&’ is supported when using an Oracle connection.

Debbie

This works great, I can now add this step to the automation I’m building.