The best I think you could achieve would be something like this...
 
Global ExecuterService es; 
 
rule "execute some SQL"
    when
        $q : Query()
        $f : Fields(query == $q)
        $t : Tables(query == $q)
        $p : Predicates(query == $q)
    then
        es.execute($f, $t, $p);
    end
 
Still not sure if a rules engine is your best option, if I understand your use case correctly.


From: Anstis, Michael (M.)
Sent: 23 June 2009 10:00
To: 'amilac@hsenidmobile.com'; 'Rules Users List'
Subject: RE: [rules-users] How to execute the SQL query using drools

Let me see if I understand correctly.
 
You want the user to be able to define the SQL query (table, field list, predicates) and have the resulting SQL executed within Drools?
 
Is this your only requirement for the rules engine; if so have you thought a rules engine might not be your best option.


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Amila Silva
Sent: 23 June 2009 09:49
To: rules-users@lists.jboss.org
Subject: [rules-users] How to execute the SQL query using drools


Hi Anstis,
  I'm creating a rule engine which is basically a SQL query executor. for that i need to have a drool
  file where i can add new rules to build the different query criteria.  user should be able to create new selection criteria.

is there any way that i can define sql queries in side the drool files.

thanks