Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to check the existance of a table ?
Try this:
FUNCTION sp_TableExist( tbl IN user_tables.table_name%TYPE )
RETURN BOOLEAN IS
CURSOR c_user_tables IS
SELECT 1 FROM user_tables WHERE table_name = UPPER(NVL(tbl, '')) AND ROWNUM < 2;
LOOP RETURN TRUE; END LOOP;
-- Vali Robert Vabo <robert.vabo_at_gecko.no> wrote in message news:2npr5.12195$541.2514526_at_juliett.dax.net...Received on Thu Aug 31 2000 - 07:06:27 CDT
> 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
>
>