Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to check the existance of a table ?
Robert,
Try the following code.
FUNCTION sp_tableexists( i_s_tablename IN VARCHAR2) RETURN BOOLEAN IS
CURSOR cq_usertab (i_s_tablename) 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;
Maarten
"Robert Vabo" <robert.vabo_at_gecko.no> wrote in message
news:2npr5.12195$541.2514526_at_juliett.dax.net...
> I want tocheck if a table exist in the database via a SP.
>
> Procedure SP_TableExist
> ( TableName varchar2)
> IS
> if exists(select * from User_Objects WHERE Object_Name = || TableName)
> return 1;
> else
> return 0;
> end if;
> end SP_TableExist;
>
> Any suggestions ?
>
> --
> Regards
> Robert Vabo
> Application developer
> Gecko Informasjonssystemer AS
> www.gecko.no
> robert.vabo_at_gecko.no
>
>
Received on Thu Aug 31 2000 - 05:16:07 CDT
![]() |
![]() |