Re: Perl Issues
Date: Thu, 21 Feb 2008 14:30:40 -0800 (PST)
Message-ID: <577463.13441.qm@web53903.mail.re2.yahoo.com>
The Perl DBI list is a pretty good place for this stuff.
some of the methods they use for metadata gathering are probably the culprits for the all_table queries. They are generated by DBI when they ask for specific metadata I suspect.
exception handling is pretty basic stuff in DBI and DBD::Oracle
there is a huge section in the man page about it.
http://linux.die.net/man/3/dbi
Typically "RaiseError" is used in conjunction with "eval { ... }" to catch the exception that's been thrown and followed by an "if ($@) { ... }" block to handle the caught exception. For example: eval { ... $sth->execute(); ... }; if ($@) { # $sth->err and $DBI::err will be true if error was from DBI warn $@; # print the error ... # do whatever you need to deal with the error }
in regards to Boolean:
DBD::Oracle does not explicitly support most Oracle data types. It simply asks Oracle to return them as strings and Oracle does so. Mostly. Similarly when binding placeholder values DBD::Oracle binds them as strings and Oracle converts them to the appropriate type, such as DATE, when used.
[...]
There are some types, like BOOLEAN, that Oracle does not automatically convert to or from strings (pity). These need to be converted explicitly using SQL or PL/SQL functions.
**just give them a 1 or 0 output from your procedure if it exists or doesn't and don't worry about the boolean
JApplewhite_at_austinisd.org wrote:
Our Developers wrote our Special Ed Student Info. application in Perl - about which I know zip. Without going into gory details of why, their code repeatedly checks for the existence of specific tables (out of the 150,000+ tables in our Production Student Info.) by doing "Select Count(*) From All_Tables Where Table_Name = '<TableName>'" whick is very inefficient, especially with 150,000 tables.
First of all, I want them to not check for table existence and code in Exception Handling, but they are resistent to my suggestions.
Second, if they don't code the Exception Handling, I want them to use a utility function that we have that more efficiently checks for table existence and returns a Boolean - True if exists, False if not exists.
My two questions:
1. Can Exception Handling be easily done in Perl? If so, any good examples I can point them to?
2. They say that Perl can't handle Boolean values. Is that true? Any guidance here?
Thanks.
Jack C. Applewhite - Database Administrator
Austin I.S.D.
414.9715 (phone) / 935.5929 (pager)
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Feb 21 2008 - 16:30:40 CST