Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2011
    Posts
    57

    Unanswered: Get from EXECUTE IMMEDIATE

    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.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

  3. #3
    Join Date
    Sep 2011
    Posts
    57
    Thanks I'll check it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •