In the Oracle unit there is a published function like this:
function FindVariables(const SQL: string; IncludeDuplicates: Boolean): TStringList;
This function will scan the SQL parameter for variables and will return them in a TStringList. The IncludeDuplicates parameter determines if duplicate variables will be included or not.