Answers for "check if column exists in table oracle"

SQL
0

check if table exists oracle

SELECT * FROM USER_TABLES WHERE TABLE_NAME = 'my_table';
-- Tables from schemes you can access
SELECT * FROM ALL_TABLES WHERE OWNER = 'scheme_name' TABLE_NAME = 'my_table';
-- Tables from schemes you can access
SELECT * FROM DBA_TABLES WHERE OWNER = 'scheme_name' TABLE_NAME = 'my_table';
Posted by: Guest on April-17-2021
0

check if table exists oracle

BEGIN
  SELECT COUNT(*)
    INTO l_cnt
    FROM dba_tables
   WHERE owner = <<table owner>>
     AND table_name = <<table name>>;
 
  IF( l_cnt > 0 )
  THEN
     EXECUTE IMMEDIATE 'SELECT col1 FROM x'
        BULK COLLECT INTO some_collection;
  ELSE
    SELECT 'table X does not exist'
      INTO some_variable
      FROM dual;
  END IF;
END;
Posted by: Guest on April-17-2021

Code answers related to "check if column exists in table oracle"

Code answers related to "SQL"

Browse Popular Code Answers by Language