using execute immediate clause inside sql() in scripts?

How can we use execute immediate inside sql() in script?
my requiremnt is -

execute immediate ‘select count(*) from $stage_table where DATA_LOAD_CONTROL_ID = $id’
into $records_inserted;

$stage_table and $id are input parameters and $records_inserted is return value.

am getting errors while executing this… as i dnt have the proper syntax for doing this… PLease help!


p.sree (BOB member since 2009-06-15)

In a DI script I would write

$records_inserted = sql('my_datastore', 'select count(*) from [$stage_table] where DATA_LOAD_CONTROL_ID = [$id]');
print('$records_inserted = [$records_inserted]');

Werner Daehn :de: (BOB member since 2004-12-17)

U r a gem!!! This worked… Thank You so much :slight_smile: :smiley:


p.sree (BOB member since 2009-06-15)