Re: How to check the existance of a table ?
From: (wrong string) înzatu <mvali_at_rds.ro>
Date: Thu, 31 Aug 2000 12:06:27 GMT
Message-ID: <7Trr5.100$bo5.3665_at_nreader1.kpnqwest.net>
BEGIN
FOR c IN c_user_tables
RETURN FALSE;
END; The boolean type of return may be any other type ...
Date: Thu, 31 Aug 2000 12:06:27 GMT
Message-ID: <7Trr5.100$bo5.3665_at_nreader1.kpnqwest.net>
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;
BEGIN
FOR c IN c_user_tables
LOOP RETURN TRUE; END LOOP;
RETURN FALSE;
END; The boolean type of return may be any other type ...
-- 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 - 14:06:27 CEST
> 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
>
>