Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL !

Re: PL/SQL !

From: George Barbour <gbarbour_at_csc.com>
Date: Sat, 25 Aug 2001 10:20:40 +0100
Message-ID: <3b876b74$1@pull.gecm.com>


It does work, but, I have a confession, s'not my code. I gratefully acquired it during an 'ora surf/trawl'.
When I find the author I will give credit. (keep better records George).

George Barbour.

"Matt B." <gtimatt_at_home.com> wrote in message news:PjDh7.68165$MC1.22154626_at_news1.elcjn1.sdca.home.com...
> "Jerry Metz" <jmetz1_at_ix.netcom.com> wrote in message
> news:3B82CEB5.7AE4C340_at_ix.netcom.com...
> > If I read your code correctly (and it's certainly possible that I'm not
> > with the day that I've had today!), your function will return FALSE even
if
> > the table exists but has no rows in it.
>
> I don't think so (keep reading...)
>
> > > FUNCTION sp_tableexists( i_s_tablename IN VARCHAR2) RETURN BOOLEAN IS
> > >
> > > CURSOR cq_usertab (i_s_tablename VARCHAR2) IS
> > > SELECT table_name FROM user_tables
> > > WHERE table_name = i_s_tablename;
> > >
> > > l_r_tablerow cq_usertab%rowtype;
> > >
> > > BEGIN
> > > OPEN cq_usertab (i_s_tablename);
> > > FETCH cq_usertab INTO l_r_tablerow;
> > > IF cq_usertab%notfound THEN
> > > CLOSE cq_usertab;
> > > RETURN FALSE;
> > > ELSE
> > > CLOSE cq_usertab;
> > > RETURN TRUE;
> > > END IF;
> > > END sp_tableexists;
>
> Look again. The cursor hits user_tables and looks for the table's
existence in
> the data dictionary. It will be %FOUND if it's there and %NOTFOUND if
it's not
> there. Doesn't have anything to do with the table existing and the #of
rows in
> it.
>
> -Matt
>
>
Received on Sat Aug 25 2001 - 04:20:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US