2 Replies Latest reply: Dec 24, 2006 9:38 AM by Mohammed Taj RSS

    difference between cat and tab

    sadasivam
      please clear this.i tried this tho query
      select * from tab;

      it display 250 records

      select * from cat;

      it display 259 records

      what's that difference,what are the infomation included in cat
        • 1. Re: difference between cat and tab
          jeneesh
          Views,Sequences,synonyms and tables are included in cat
          sql> select distinct table_type from cat;
          TABLE_TYPE
          -----------
          SEQUENCE
          SYNONYM
          TABLE
          VIEW                                                                                                                                                                                                                                                                                                                                   
          • 2. Re: difference between cat and tab
            Mohammed Taj
            hi,
            SQL> conn system/oracle
            Connected.
            SQL> select count(*) from tab;

              COUNT(*)
            ----------
                   155

            SQL> select count(*) from cat;

              COUNT(*)
            ----------
                   175

            SQL> desc tab;
            Name                                      Null?    Type
            ----------------------------------------- -------- ----------------------------

            TNAME                                     NOT NULL VARCHAR2(30)
            TABTYPE                                            VARCHAR2(7)
            CLUSTERID                                          NUMBER

            SQL> select tabtype,count(tname)
              2  from tab
              3  group by tabtype;

            TABTYPE COUNT(TNAME)
            ------- ------------
            SYNONYM            8
            TABLE            137
            VIEW              10

            SQL> desc cat;
            Name                                      Null?    Type
            ----------------------------------------- -------- ----------------------------

            TABLE_NAME                                NOT NULL VARCHAR2(30)
            TABLE_TYPE                                         VARCHAR2(11)

            SQL> select table_type,count(*)
              2  from cat
              3  group by table_type;

            TABLE_TYPE    COUNT(*)
            ----------- ----------
            SEQUENCE            20
            SYNONYM              8
            TABLE              137
            VIEW                10

            SQL>
            SQL> select distinct tabtype from tab;

            TABTYPE
            -------
            SYNONYM
            TABLE
            VIEW

            SQL> select distinct table_type from cat;

            TABLE_TYPE
            -----------
            SEQUENCE
            SYNONYM
            TABLE
            VIEW
            regards
            Taj