Execute a query in beforeOpen and pass the output as a variable in open method in BIRT Report

I need to execute a query like ( SELECT column1 FROM table 1WHERE column2='ABC 'AND id = '1234859') . The output of this query will be 'X2224891', 'Y2839120' . I need to pass this output as a variable to the main query written in the open method. Is this possible to do it in the beforeOpen or any other way to achieve this?