|
|
Archives of the TeradataForum
Message Posted: Mon, 20 Dec 2010 @ 16:08:44 GMT
Subj: | | Re: How to query spl text |
|
From: | | Geoffrey Rommel |
| We have a few hundred of these to comb through. Is there any way to do this through SQL to do a LIKE on the procedure definition? | |
Perl allows you to use regular expressions, which are richer than LIKE.
#perl -- fill in missing pieces as needed for your application
use Teradata::SQL;
$dbh = Teradata::SQL::connect("mrbig/bogart,bacall");
# Construct list of procedures, perhaps using Dave Curley's query.
@procs = list_procedures();
# Run SHOW PROCEDURE on each one.
foreach $p (@procs) {
$show = $dbh->open("show procedure $p");
$proc_text = '';
while (@row = $show->fetchrow_list) {
$proc_text .= $row[0];
}
$show->close;
# Now use regex to analyze the procedure text.
if ($proc_text =~ /your-regex-here/) {
print "Found this: $proc_text\n";
}
}
$dbh->disconnect;
| |