Search code examples
sybase

Assigning dynamic executed query to variables


Is there any way in SYBASE to store the values which is returned from (EXECUTE IMMEDIATE) dynamic query to variables

EXECUTE IMMEDIATE SQL
INTO x, y

Solution

  • Not sure if this is what you are looking for, but for what it's worth... BEGIN

         DECLARE x int;
         DECLARE y int;
    
         EXECUTE IMMEDIATE
         'SET x = 5';
         EXECUTE IMMEDIATE
         'SET y = 3';
    
         SELECT x,y;
    
    END