Hi all.
I'm doing a dynmamic query where you can set any table and any field from it, but I've gotta cath a result from the query example:
SET var = (select count(*) from table where field = 9);
To do this i'm doing this:
SET VLV_Tabla= 'CAT_CUENTAS';
SET VLV_Field = 'ID_CUENTA';
SET VLV_Query = ('SELECT COUNT(*) FROM NOM_ESQ.' || VLV_Tabla || ' WHERE ' || VLV_Campo || ' = 9');
EXECUTE IMMEDIATE VLV_Query;
SET VAR = VLV_Query; -- I know this is impossible but is what I need.
As you know whe you use EXECUTE IMMEDIATE you can't write a Select in you query. Does anybody know how could I get the value from the sentence but it has to be dynamic.
Best regards.