Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Testing a table existence
Try this .--------
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;
George Barbour.
"Sylvain BOURDETTE" <sbourdette_at_danet.fr> wrote in message
news:3c14cac6$0$3179$626a54ce_at_news.free.fr...
> How in PL SQL, can test if a table exists ?
>
> I try this
>
> IF EXISTS MyTable THEN
>
> END IF;
>
> But it doesn't work
>
> Thanks
>
>
Received on Mon Dec 10 2001 - 10:10:13 CST